borg/.github/workflows/ci.yml
Thomas Waldmann 99a52ce3ca
CI: give the macOS runners a resolvable hostname (1.2-maint)
Backport of #10135 (master) / #10139 (1.4-maint). The runner hostname is a
long, unresolvable .local name and macOS needs ~35s to give up resolving it.
borg resolves the fqdn at import time (platform/base.py), so every spawned
borg process paid those 35s - the last 1.2-maint macOS job hit the 6h job
limit and got cancelled.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-21 23:25:09 +02:00

149 lines
4.6 KiB
YAML

# badge: https://github.com/borgbackup/borg/workflows/CI/badge.svg?branch=master
name: CI
on:
push:
branches: [ 1.2-maint ]
paths:
- '**.py'
- '**.pyx'
- '**.c'
- '**.h'
- '**.yml'
- '**.toml'
- '**.cfg'
- '**.ini'
- 'requirements.d/*'
- '!docs/**'
pull_request:
branches: [ 1.2-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@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.11
- name: Lint with flake8
run: |
pip install flake8
flake8 src scripts
pytest:
needs: lint
strategy:
fail-fast: false
matrix:
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
- os: ubuntu-24.04
python-version: '3.12'
toxenv: py312-fuse3
- os: macos-15
python-version: '3.11'
toxenv: py311-none # note: no fuse testing, due to #6099, see also #6196.
env:
# Configure pkg-config to use OpenSSL from Homebrew
PKG_CONFIG_PATH: "/opt/homebrew/opt/openssl@3.0/lib/pkgconfig:$PKG_CONFIG_PATH"
TOXENV: ${{ matrix.toxenv }}
runs-on: ${{ matrix.os }}
timeout-minutes: 360
steps:
- uses: actions/checkout@v7
with:
# just fetching 1 commit is not enough for setuptools-scm, so we fetch all
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v6
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ hashFiles('requirements.d/development.txt') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pip-
- 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 install pkg-config || brew upgrade pkg-config
brew install zstd || brew upgrade zstd
brew install lz4 || brew upgrade lz4
brew install xxhash || brew upgrade xxhash
brew install openssl@3.0 || brew upgrade openssl@3.0
# the runner's unresolvable .local hostname takes macOS ~35s to give up on,
# which borg pays per spawned process (import-time fqdn) - hours of test time,
# see #9470. .local is mDNS territory, an /etc/hosts entry alone does not help.
sudo scutil --set HostName borg-ci-mac
echo "127.0.0.1 borg-ci-mac" | sudo tee -a /etc/hosts
- name: Install Python requirements
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.d/development.txt
- name: Install borgbackup
env:
# we already have that in the global env, but something is broken and overwrites that.
# so, set it here, again.
PKG_CONFIG_PATH: "/opt/homebrew/opt/openssl@3.0/lib/pkgconfig:$PKG_CONFIG_PATH"
run: |
# pip install -e .
python setup.py -v develop
- name: run pytest via tox
env:
# we already have that in the global env, but something is broken and overwrites that.
# so, set it here, again.
PKG_CONFIG_PATH: "/opt/homebrew/opt/openssl@3.0/lib/pkgconfig:$PKG_CONFIG_PATH"
run: |
# do not use fakeroot, but run as root. avoids the dreaded EISDIR sporadic failures. see #2482.
#sudo -E bash -c "tox -e py"
tox --skip-missing-interpreters
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
env:
OS: ${{ runner.os }}
python: ${{ matrix.python-version }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS, python