diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml new file mode 100644 index 0000000000..0220047a50 --- /dev/null +++ b/.github/workflows/freebsd.yml @@ -0,0 +1,120 @@ +name: FreeBSD 14 CI + +on: + push: + branches: [ master ] + tags: + - '2.*' + pull_request: + branches: [ master ] + paths: + - '**.py' + - '**.pyx' + - '**.c' + - '**.h' + - '**.yml' + - '**.toml' + - '**.cfg' + - '**.ini' + - 'requirements.d/*' + - '!docs/**' + +jobs: + freebsd-14: + name: FreeBSD 14 tests and build + permissions: + contents: read + id-token: write + attestations: write + runs-on: ubuntu-24.04 + continue-on-error: true + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + - name: Run on FreeBSD 14 + id: freebsd + uses: cross-platform-actions/action@v0.29.0 + with: + operating_system: freebsd + version: '14.3' + # Use bash for consistent scripting + shell: bash + # Increase resources a bit for building Cython extensions + cpu_count: 3 + memory: 8G + run: | + set -euxo pipefail + # Update package catalog and install dependencies + export IGNORE_OSVERSION=yes + sudo -E pkg update -f + sudo -E pkg install -y xxhash liblz4 zstd pkgconf + sudo -E pkg install -y fusefs-libs || true + sudo -E pkg install -y fusefs-libs3 || true + sudo -E pkg install -y rust + sudo -E pkg install -y git bash # fakeroot causes lots of troubles on freebsd + sudo -E pkg install -y python310 py310-sqlite3 + sudo -E pkg install -y python311 py311-sqlite3 py311-pip py311-virtualenv + + # Ensure python3 and pip point to the chosen version + sudo ln -sf /usr/local/bin/python3.11 /usr/local/bin/python3 || true + sudo ln -sf /usr/local/bin/python3.11 /usr/local/bin/python || true + sudo ln -sf /usr/local/bin/pip3.11 /usr/local/bin/pip3 || true + sudo ln -sf /usr/local/bin/pip3.11 /usr/local/bin/pip || true + + # Create and activate venv + python -m venv .venv + . .venv/bin/activate + + # Build prerequisites + python -V + pip -V + python -m pip install --upgrade pip wheel + # Install dev requirements and project in editable mode + python -m pip install -r requirements.d/development.txt + python -m pip install -e . + + # Run tests (skip benchmarks which are slow on CI) + python -m pytest -n auto --benchmark-skip + + # Only build PyInstaller binaries for tags + if [[ "${GITHUB_REF:-}" == refs/tags/* ]]; then + python -m pip install 'pyinstaller==6.14.2' + mkdir -p dist/binary + pyinstaller --clean --distpath=dist/binary scripts/borg.exe.spec + # Smoke-test the built binaries and package dir-mode as tarball + 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 + # Prepare artifacts + mkdir -p artifacts + if [ -f dist/binary/borg.exe ]; then + cp -v dist/binary/borg.exe artifacts/borg-freebsd-14-x86_64-gh + fi + if [ -f dist/binary/borg.tgz ]; then + cp -v dist/binary/borg.tgz artifacts/borg-freebsd-14-x86_64-gh.tgz + fi + fi + + - name: Upload FreeBSD artifacts + if: startsWith(github.ref, 'refs/tags/') + uses: actions/upload-artifact@v4 + with: + name: freebsd14-dist + path: artifacts/* + if-no-files-found: ignore + + - name: Attest provenance for FreeBSD artifacts + if: startsWith(github.ref, 'refs/tags/') + uses: actions/attest-build-provenance@v3 + with: + subject-path: 'artifacts/*'