Skip to content

Commit a022d56

Browse files
CI: backport vm_tests (FreeBSD/NetBSD/OpenBSD/Haiku) from master branch
1 parent b386060 commit a022d56

File tree

1 file changed

+179
-0
lines changed

1 file changed

+179
-0
lines changed

.github/workflows/ci.yml

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,182 @@ jobs:
254254
name: ${{ matrix.binary }}
255255
path: artifacts/*
256256
if-no-files-found: error
257+
258+
vm_tests:
259+
260+
# Cross-OS tests running inside VMs, aligned with master branch structure.
261+
# Uses cross-platform-actions/action to run on FreeBSD, NetBSD, OpenBSD, Haiku.
262+
permissions:
263+
contents: read
264+
id-token: write
265+
attestations: write
266+
runs-on: ubuntu-24.04
267+
timeout-minutes: 90
268+
needs: [lint]
269+
continue-on-error: true
270+
strategy:
271+
fail-fast: false
272+
matrix:
273+
include:
274+
- os: freebsd
275+
version: '14.3'
276+
display_name: FreeBSD
277+
# Controls binary build and provenance attestation on tags
278+
do_binaries: true
279+
artifact_prefix: borg-freebsd-14-x86_64-gh
280+
- os: netbsd
281+
version: '10.1'
282+
display_name: NetBSD
283+
do_binaries: false
284+
- os: openbsd
285+
version: '7.7'
286+
display_name: OpenBSD
287+
do_binaries: false
288+
- os: haiku
289+
version: 'r1beta5'
290+
display_name: Haiku
291+
do_binaries: false
292+
293+
steps:
294+
- name: Check out repository
295+
uses: actions/checkout@v4
296+
with:
297+
fetch-depth: 0
298+
fetch-tags: true
299+
300+
- name: Test on ${{ matrix.display_name }}
301+
id: cross_os
302+
uses: cross-platform-actions/[email protected]
303+
env:
304+
DO_BINARIES: ${{ matrix.do_binaries }}
305+
with:
306+
operating_system: ${{ matrix.os }}
307+
version: ${{ matrix.version }}
308+
shell: bash
309+
run: |
310+
set -euxo pipefail
311+
case "${{ matrix.os }}" in
312+
freebsd)
313+
export IGNORE_OSVERSION=yes
314+
sudo -E pkg update -f
315+
sudo -E pkg install -y xxhash liblz4 zstd pkgconf
316+
# Install one of the FUSE libraries; fail if neither is available
317+
sudo -E pkg install -y fusefs-libs || sudo -E pkg install -y fusefs-libs3
318+
sudo -E pkg install -y rust
319+
sudo -E pkg install -y git
320+
sudo -E pkg install -y python310 py310-sqlite3
321+
sudo -E pkg install -y python311 py311-sqlite3 py311-pip py311-virtualenv
322+
sudo ln -sf /usr/local/bin/python3.11 /usr/local/bin/python3
323+
sudo ln -sf /usr/local/bin/python3.11 /usr/local/bin/python
324+
sudo ln -sf /usr/local/bin/pip3.11 /usr/local/bin/pip3
325+
sudo ln -sf /usr/local/bin/pip3.11 /usr/local/bin/pip
326+
python -m venv .venv
327+
. .venv/bin/activate
328+
python -V
329+
pip -V
330+
python -m pip install --upgrade pip wheel
331+
pip install -r requirements.d/development.txt
332+
pip install -e .
333+
tox -e py311-none
334+
if [[ "${{ matrix.do_binaries }}" == "true" && "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
335+
python -m pip install 'pyinstaller==6.14.2'
336+
mkdir -p dist/binary
337+
pyinstaller --clean --distpath=dist/binary scripts/borg.exe.spec
338+
pushd dist/binary
339+
echo "single-file binary"
340+
chmod +x borg.exe
341+
./borg.exe -V
342+
echo "single-directory binary"
343+
chmod +x borg-dir/borg.exe
344+
./borg-dir/borg.exe -V
345+
tar czf borg.tgz borg-dir
346+
popd
347+
mkdir -p artifacts
348+
if [ -f dist/binary/borg.exe ]; then
349+
cp -v dist/binary/borg.exe artifacts/${{ matrix.artifact_prefix }}
350+
fi
351+
if [ -f dist/binary/borg.tgz ]; then
352+
cp -v dist/binary/borg.tgz artifacts/${{ matrix.artifact_prefix }}.tgz
353+
fi
354+
fi
355+
;;
356+
netbsd)
357+
arch="$(uname -m)"
358+
sudo -E mkdir -p /usr/pkg/etc/pkgin
359+
echo "http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/${arch}/10.1/All" | sudo tee /usr/pkg/etc/pkgin/repositories.conf > /dev/null
360+
sudo -E pkgin update
361+
sudo -E pkgin -y upgrade
362+
sudo -E pkgin -y install zstd lz4 xxhash git
363+
sudo -E pkgin -y install rust
364+
sudo -E pkgin -y install pkg-config
365+
sudo -E pkgin -y install py311-pip py311-virtualenv py311-tox
366+
sudo -E ln -sf /usr/pkg/bin/python3.11 /usr/pkg/bin/python3
367+
sudo -E ln -sf /usr/pkg/bin/pip3.11 /usr/pkg/bin/pip3
368+
sudo -E ln -sf /usr/pkg/bin/virtualenv-3.11 /usr/pkg/bin/virtualenv3
369+
sudo -E ln -sf /usr/pkg/bin/tox-3.11 /usr/pkg/bin/tox3
370+
# Ensure base system admin tools are on PATH for the non-root shell
371+
export PATH="/sbin:/usr/sbin:$PATH"
372+
echo "--- Preparing an extattr-enabled filesystem ---"
373+
# On many NetBSD setups /tmp is tmpfs without extended attributes.
374+
# Create a FFS image with extended attributes enabled and use it for TMPDIR.
375+
VNDDEV="vnd0"
376+
IMGFILE="/tmp/fs.img"
377+
sudo -E dd if=/dev/zero of=${IMGFILE} bs=1m count=1024
378+
sudo -E vndconfig -c "${VNDDEV}" "${IMGFILE}"
379+
sudo -E newfs -O 2ea /dev/r${VNDDEV}a
380+
MNT="/mnt/eafs"
381+
sudo -E mkdir -p ${MNT}
382+
sudo -E mount -t ffs -o extattr /dev/${VNDDEV}a $MNT
383+
export TMPDIR="${MNT}/tmp"
384+
sudo -E mkdir -p ${TMPDIR}
385+
sudo -E chmod 1777 ${TMPDIR}
386+
touch ${TMPDIR}/testfile
387+
lsextattr user ${TMPDIR}/testfile && echo "[xattr] *** xattrs SUPPORTED on ${TMPDIR}! ***"
388+
tox3 -e py311-none
389+
;;
390+
openbsd)
391+
sudo -E pkg_add xxhash lz4 zstd git
392+
sudo -E pkg_add rust
393+
sudo -E pkg_add openssl%3.4
394+
sudo -E pkg_add py3-pip py3-virtualenv py3-tox
395+
export BORG_OPENSSL_NAME=eopenssl34
396+
tox -e py312-none
397+
;;
398+
haiku)
399+
pkgman refresh
400+
pkgman install -y git pkgconfig zstd lz4 xxhash
401+
pkgman install -y openssl3
402+
pkgman install -y rust_bin
403+
pkgman install -y python3.10
404+
pkgman install -y cffi
405+
pkgman install -y lz4_devel zstd_devel xxhash_devel openssl3_devel libffi_devel
406+
# there is no pkgman package for tox, so we install it into a venv
407+
python3 -m ensurepip --upgrade
408+
python3 -m pip install --upgrade pip wheel
409+
python3 -m venv .venv
410+
. .venv/bin/activate
411+
export PKG_CONFIG_PATH="/system/develop/lib/pkgconfig:/system/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
412+
export BORG_LIBLZ4_PREFIX=/system/develop
413+
export BORG_LIBZSTD_PREFIX=/system/develop
414+
export BORG_LIBXXHASH_PREFIX=/system/develop
415+
export BORG_OPENSSL_PREFIX=/system/develop
416+
pip install -r requirements.d/development.txt
417+
pip install -e .
418+
# troubles with either tox or pytest xdist, so we run pytest manually:
419+
pytest -v -rs --benchmark-skip -k "not remote and not socket"
420+
;;
421+
esac
422+
423+
- name: Upload artifacts
424+
if: startsWith(github.ref, 'refs/tags/') && matrix.do_binaries
425+
uses: actions/upload-artifact@v4
426+
with:
427+
name: ${{ matrix.os }}-${{ matrix.version }}-dist
428+
path: artifacts/*
429+
if-no-files-found: ignore
430+
431+
- name: Attest provenance
432+
if: startsWith(github.ref, 'refs/tags/') && matrix.do_binaries
433+
uses: actions/attest-build-provenance@v3
434+
with:
435+
subject-path: 'artifacts/*'

0 commit comments

Comments
 (0)