Skip to content

Integrate CI (master) #2

Integrate CI (master)

Integrate CI (master) #2

name: CI Cross-Platform
on:
push:
branches: [ master ]
tags:
- '2.*'
pull_request:
branches: [ master ]
paths:
- '**.py'
- '**.pyx'
- '**.c'
- '**.h'
- '**.yml'
- '**.toml'
- '**.cfg'
- '**.ini'
- 'requirements.d/*'
- '!docs/**'
jobs:
cross_platform_tests:
name: ${{ matrix.display_name }} tests
permissions:
contents: read
id-token: write
attestations: write
runs-on: ubuntu-24.04
timeout-minutes: 90
continue-on-error: true
strategy:
fail-fast: false
matrix:
include:
- os: freebsd
version: '14.3'
display_name: FreeBSD
# Controls binary build and provenance attestation on tags
do_binaries: true
artifact_prefix: borg-freebsd-14-x86_64-gh
- os: netbsd
version: '10.1'
display_name: NetBSD
do_binaries: false
- os: openbsd
version: '7.7'
display_name: OpenBSD
do_binaries: false
- os: haiku
version: 'r1beta5'
display_name: Haiku
do_binaries: false
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Run on ${{ matrix.display_name }}
id: cross_os
uses: cross-platform-actions/[email protected]
env:
DO_BINARIES: ${{ matrix.do_binaries }}
with:
operating_system: ${{ matrix.os }}
version: ${{ matrix.version }}
shell: bash
run: |
set -euxo pipefail
case "${{ matrix.os }}" in
freebsd)
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
sudo -E pkg install -y python310 py310-sqlite3
sudo -E pkg install -y python311 py311-sqlite3 py311-pip py311-virtualenv
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
python -m venv .venv
. .venv/bin/activate
python -V
pip -V
python -m pip install --upgrade pip wheel
pip install -r requirements.d/development.txt
pip install -e .
pytest -v -n auto --benchmark-skip
if [[ "${DO_BINARIES}" == "true" && "${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
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
mkdir -p artifacts
if [ -f dist/binary/borg.exe ]; then
cp -v dist/binary/borg.exe artifacts/${{ matrix.artifact_prefix }}
fi
if [ -f dist/binary/borg.tgz ]; then
cp -v dist/binary/borg.tgz artifacts/${{ matrix.artifact_prefix }}.tgz
fi
fi
;;
netbsd)
arch="$(uname -m)"
sudo -E mkdir -p /usr/pkg/etc/pkgin
echo "http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/${arch}/10.1/All" | sudo tee /usr/pkg/etc/pkgin/repositories.conf > /dev/null
sudo -E pkgin update || true
sudo -E pkgin -y upgrade || true
sudo -E pkgin -y install zstd lz4 xxhash git || true
sudo -E pkgin -y install rust || true
sudo -E pkgin -y install pkg-config || true
sudo -E pkgin -y install py311-pip py311-virtualenv || true
sudo -E ln -sf /usr/pkg/bin/python3.11 /usr/pkg/bin/python3 || true
sudo -E ln -sf /usr/pkg/bin/pip3.11 /usr/pkg/bin/pip3 || true
sudo -E ln -sf /usr/pkg/bin/virtualenv-3.11 /usr/pkg/bin/virtualenv3 || true
python3 -m virtualenv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.d/development.txt
pip install -e .
pytest -v -n auto --benchmark-skip
;;
openbsd)
# echo "https://ftp.eu.openbsd.org/pub/OpenBSD" | sudo tee /etc/installurl > /dev/null || true
sudo -E pkg_add xxhash || true
sudo -E pkg_add lz4 || true
sudo -E pkg_add zstd || true
sudo -E pkg_add git || true
sudo -E pkg_add rust || true
sudo -E pkg_add openssl%3.4 || true
sudo -E pkg_add py3-pip || true
sudo -E pkg_add py3-virtualenv || true
export BORG_OPENSSL_NAME=eopenssl34
python3 -m virtualenv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.d/development.txt
pip install -e .
pytest -v -n auto --benchmark-skip
;;
haiku)
pkgman refresh || true
pkgman install -y git pkgconfig zstd lz4 xxhash || true
pkgman install -y openssl3 || true
pkgman install -y rust_bin || true
pkgman install -y python3.10 || true
pkgman install -y cffi || true
python3 -V || true
pkgman install -y lz4_devel zstd_devel xxhash_devel openssl3_devel libffi_devel || true
export PKG_CONFIG_PATH="/system/develop/lib/pkgconfig:/system/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
export BORG_LIBLZ4_PREFIX=/system/develop
export BORG_LIBZSTD_PREFIX=/system/develop
export BORG_LIBXXHASH_PREFIX=/system/develop
export BORG_OPENSSL_PREFIX=/system/develop
python3 -m ensurepip --upgrade || true
python3 -m pip install --upgrade pip wheel
python3 -m venv .venv
. .venv/bin/activate
python -V
pip install -r requirements.d/development.txt
pip install -e .
pytest -v --benchmark-skip -k "not remote and not socket"
;;
esac
- name: Upload artifacts
if: startsWith(github.ref, 'refs/tags/') && matrix.do_binaries
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.version }}-dist
path: artifacts/*
if-no-files-found: ignore
- name: Attest provenance
if: startsWith(github.ref, 'refs/tags/') && matrix.do_binaries
uses: actions/attest-build-provenance@v3
with:
subject-path: 'artifacts/*'