mirror of
https://github.com/borgbackup/borg.git
synced 2026-03-23 19:05:33 -04:00
there are no other free macOS Intel gh action runners for opensource projects. :-( the macOS 13 runner is deprecated, so guess it will be game-over for macOS Intel 2025-12.
193 lines
6.1 KiB
YAML
193 lines
6.1 KiB
YAML
# badge: https://github.com/borgbackup/borg/workflows/CI/badge.svg?branch=1.4-maint
|
|
|
|
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ 1.4-maint ]
|
|
paths:
|
|
- '**.py'
|
|
- '**.pyx'
|
|
- '**.c'
|
|
- '**.h'
|
|
- '**.yml'
|
|
- '**.toml'
|
|
- '**.cfg'
|
|
- '**.ini'
|
|
- 'requirements.d/*'
|
|
- '!docs/**'
|
|
pull_request:
|
|
branches: [ 1.4-maint ]
|
|
paths:
|
|
- '**.py'
|
|
- '**.pyx'
|
|
- '**.c'
|
|
- '**.h'
|
|
- '**.yml'
|
|
- '**.toml'
|
|
- '**.cfg'
|
|
- '**.ini'
|
|
- 'requirements.d/*'
|
|
- '!docs/**'
|
|
|
|
jobs:
|
|
lint:
|
|
|
|
runs-on: ubuntu-22.04
|
|
timeout-minutes: 5
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: chartboost/ruff-action@v1
|
|
|
|
pytest:
|
|
|
|
needs: lint
|
|
strategy:
|
|
fail-fast: false
|
|
# noinspection YAMLSchemaValidation
|
|
matrix: >-
|
|
${{ fromJSON(
|
|
github.event_name == 'pull_request' && '{
|
|
"include": [
|
|
{"os": "ubuntu-22.04", "python-version": "3.9", "toxenv": "py39-fuse2"},
|
|
{"os": "ubuntu-24.04", "python-version": "3.14", "toxenv": "py314-fuse3"}
|
|
]
|
|
}' || '{
|
|
"include": [
|
|
{"os": "ubuntu-22.04", "python-version": "3.9", "toxenv": "py39-fuse2"},
|
|
{"os": "ubuntu-22.04", "python-version": "3.10", "toxenv": "py310-fuse3"},
|
|
{"os": "ubuntu-22.04", "python-version": "3.11", "toxenv": "py311-fuse2", "binary": "borg-linux-glibc235-x86_64-gh"},
|
|
{"os": "ubuntu-22.04-arm", "python-version": "3.11", "toxenv": "py311-fuse2", "binary": "borg-linux-glibc235-arm64-gh"},
|
|
{"os": "ubuntu-24.04", "python-version": "3.12", "toxenv": "py312-fuse3"},
|
|
{"os": "ubuntu-24.04", "python-version": "3.13", "toxenv": "py313-fuse3"},
|
|
{"os": "ubuntu-24.04", "python-version": "3.14", "toxenv": "py314-fuse3"},
|
|
{"os": "macos-13", "python-version": "3.11", "toxenv": "py311-none", "binary": "borg-macos-13-x86_64-gh"},
|
|
{"os": "macos-14", "python-version": "3.11", "toxenv": "py311-none", "binary": "borg-macos-14-arm64-gh"}
|
|
]
|
|
}'
|
|
) }}
|
|
|
|
env:
|
|
TOXENV: ${{ matrix.toxenv }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 180
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
# Just fetching one commit is not enough for setuptools-scm, so we fetch all
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
|
|
- name: Detect if commit is tagged
|
|
id: detect_tag
|
|
run: |
|
|
tag="$(git describe --exact-match --tags HEAD 2>/dev/null || true)"
|
|
# If HEAD is a merge commit, the PR head is usually the second parent (HEAD^2).
|
|
if [ -z "$tag" ] && git rev-parse -q --verify HEAD^2 >/dev/null 2>&1; then
|
|
tag="$(git describe --exact-match --tags HEAD^2 2>/dev/null || true)"
|
|
fi
|
|
echo "Found tag: ${tag}"
|
|
echo "tagged=$tag" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Check out exact tag
|
|
if: ${{ steps.detect_tag.outputs.tagged }}
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ steps.detect_tag.outputs.tagged }}
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Cache pip
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.d/development.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
${{ runner.os }}-
|
|
|
|
- name: Install Linux packages
|
|
if: ${{ runner.os == 'Linux' }}
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libssl-dev libacl1-dev liblz4-dev libzstd-dev pkg-config build-essential
|
|
sudo apt-get install -y libxxhash-dev || true
|
|
sudo apt-get install -y libfuse-dev fuse || true # Required for Python llfuse module
|
|
sudo apt-get install -y libfuse3-dev fuse3 || true # Required for Python pyfuse3 module
|
|
|
|
- name: Install macOS packages
|
|
if: ${{ runner.os == 'macOS' }}
|
|
run: brew bundle install
|
|
|
|
- name: Install Python requirements
|
|
run: |
|
|
python -m pip install --upgrade pip setuptools wheel
|
|
pip install -r requirements.d/development.txt
|
|
|
|
- name: Install BorgBackup
|
|
run: |
|
|
pip install -ve .
|
|
|
|
- name: Run pytest via tox
|
|
run: |
|
|
# Do not use fakeroot; run as root. Avoids the dreaded sporadic EISDIR failures; see #2482.
|
|
#sudo -E bash -c "tox -e py"
|
|
tox --skip-missing-interpreters
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v4
|
|
env:
|
|
OS: ${{ runner.os }}
|
|
python: ${{ matrix.python-version }}
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
env_vars: OS, python
|
|
|
|
- name: Build Borg fat binaries (${{ matrix.binary }})
|
|
if: ${{ matrix.binary && steps.detect_tag.outputs.tagged }}
|
|
run: |
|
|
pip install 'pyinstaller==6.14.2'
|
|
mkdir -p dist/binary
|
|
pyinstaller --clean --distpath=dist/binary scripts/borg.exe.spec
|
|
|
|
- name: Smoke-test the built binary (${{ matrix.binary }})
|
|
if: ${{ matrix.binary && steps.detect_tag.outputs.tagged }}
|
|
run: |
|
|
pushd dist/binary
|
|
echo "single-file binary"
|
|
chmod +x borg.exe
|
|
./borg.exe -V
|
|
echo "single-directory binary"
|
|
chmod +x borg-dir/borg.exe
|
|
./borg-dir/borg.exe -V
|
|
tar czf borg.tgz borg-dir
|
|
popd
|
|
|
|
- name: Prepare binaries (${{ matrix.binary }})
|
|
if: ${{ matrix.binary && steps.detect_tag.outputs.tagged }}
|
|
run: |
|
|
mkdir -p artifacts
|
|
if [ -f dist/binary/borg.exe ]; then
|
|
cp dist/binary/borg.exe artifacts/${{ matrix.binary }}
|
|
fi
|
|
if [ -f dist/binary/borg.tgz ]; then
|
|
cp dist/binary/borg.tgz artifacts/${{ matrix.binary }}.tgz
|
|
fi
|
|
echo "binary files"
|
|
ls -l artifacts/
|
|
|
|
- name: Upload binaries (${{ matrix.binary }})
|
|
if: ${{ matrix.binary && steps.detect_tag.outputs.tagged }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.binary }}
|
|
path: artifacts/*
|
|
if-no-files-found: error
|