ci.yml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. # badge: https://github.com/borgbackup/borg/workflows/CI/badge.svg?branch=master
  2. name: CI
  3. on:
  4. push:
  5. branches: [ master ]
  6. tags:
  7. - '2.*'
  8. pull_request:
  9. branches: [ master ]
  10. paths:
  11. - '**.py'
  12. - '**.pyx'
  13. - '**.c'
  14. - '**.h'
  15. - '**.yml'
  16. - '**.toml'
  17. - '**.cfg'
  18. - '**.ini'
  19. - 'requirements.d/*'
  20. - '!docs/**'
  21. jobs:
  22. lint:
  23. runs-on: ubuntu-22.04
  24. timeout-minutes: 5
  25. steps:
  26. - uses: actions/checkout@v4
  27. - uses: chartboost/ruff-action@v1
  28. security:
  29. runs-on: ubuntu-24.04
  30. timeout-minutes: 5
  31. steps:
  32. - uses: actions/checkout@v4
  33. - name: Set up Python
  34. uses: actions/setup-python@v5
  35. with:
  36. python-version: '3.10'
  37. - name: Install dependencies
  38. run: |
  39. python -m pip install --upgrade pip
  40. pip install bandit[toml]
  41. - name: Run Bandit
  42. run: |
  43. bandit -r src/borg -c pyproject.toml
  44. asan_ubsan:
  45. runs-on: ubuntu-24.04
  46. timeout-minutes: 25
  47. needs: [lint, security]
  48. steps:
  49. - uses: actions/checkout@v4
  50. with:
  51. # Just fetching one commit is not enough for setuptools-scm, so we fetch all.
  52. fetch-depth: 0
  53. fetch-tags: true
  54. - name: Set up Python
  55. uses: actions/setup-python@v5
  56. with:
  57. python-version: '3.12'
  58. - name: Install system packages
  59. run: |
  60. sudo apt-get update
  61. sudo apt-get install -y pkg-config build-essential
  62. sudo apt-get install -y libssl-dev libacl1-dev libxxhash-dev liblz4-dev libzstd-dev
  63. - name: Install Python dependencies
  64. run: |
  65. python -m pip install --upgrade pip
  66. pip install -r requirements.d/development.txt
  67. - name: Build Borg with ASan/UBSan
  68. # Build the C/Cython extensions with AddressSanitizer and UndefinedBehaviorSanitizer enabled.
  69. # How this works:
  70. # - The -fsanitize=address,undefined flags inject runtime checks into our native code. If a bug is hit
  71. # (e.g., buffer overflow, use-after-free, out-of-bounds, or undefined behavior), the sanitizer prints
  72. # a detailed error report to stderr, including a stack trace, and forces the process to exit with
  73. # non-zero status. In CI, this will fail the step/job so you will notice.
  74. # - ASAN_OPTIONS/UBSAN_OPTIONS configure the sanitizers' runtime behavior (see below for meanings).
  75. env:
  76. CFLAGS: "-O1 -g -fno-omit-frame-pointer -fsanitize=address,undefined"
  77. CXXFLAGS: "-O1 -g -fno-omit-frame-pointer -fsanitize=address,undefined"
  78. LDFLAGS: "-fsanitize=address,undefined"
  79. # ASAN_OPTIONS controls AddressSanitizer runtime tweaks:
  80. # - detect_leaks=0: Disable LeakSanitizer to avoid false positives with CPython/pymalloc in short-lived tests.
  81. # - strict_string_checks=1: Make invalid string operations (e.g., over-reads) more likely to be detected.
  82. # - check_initialization_order=1: Catch uses that depend on static initialization order (C++).
  83. # - detect_stack_use_after_return=1: Detect stack-use-after-return via stack poisoning (may increase overhead).
  84. ASAN_OPTIONS: "detect_leaks=0:strict_string_checks=1:check_initialization_order=1:detect_stack_use_after_return=1"
  85. # UBSAN_OPTIONS controls UndefinedBehaviorSanitizer runtime:
  86. # - print_stacktrace=1: Include a stack trace for UB reports to ease debugging.
  87. # Note: UBSan is recoverable by default (process may continue after reporting). If you want CI to
  88. # abort immediately and fail on the first UB, add `halt_on_error=1` (e.g., UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1").
  89. UBSAN_OPTIONS: "print_stacktrace=1"
  90. # PYTHONDEVMODE enables additional Python runtime checks and warnings.
  91. PYTHONDEVMODE: "1"
  92. run: pip install -e .
  93. - name: Run tests under sanitizers
  94. env:
  95. ASAN_OPTIONS: "detect_leaks=0:strict_string_checks=1:check_initialization_order=1:detect_stack_use_after_return=1"
  96. UBSAN_OPTIONS: "print_stacktrace=1"
  97. PYTHONDEVMODE: "1"
  98. # Ensure the ASan runtime is loaded first to avoid "ASan runtime does not come first" warnings.
  99. # We discover libasan/libubsan paths via gcc and preload them for the Python test process.
  100. # the remote tests are slow and likely won't find anything useful
  101. run: |
  102. set -euo pipefail
  103. export LD_PRELOAD="$(gcc -print-file-name=libasan.so):$(gcc -print-file-name=libubsan.so)"
  104. echo "Using LD_PRELOAD=$LD_PRELOAD"
  105. pytest -v --benchmark-skip -k "not remote"
  106. native_tests:
  107. needs: [lint, security]
  108. permissions:
  109. contents: read
  110. id-token: write
  111. attestations: write
  112. strategy:
  113. fail-fast: true
  114. # noinspection YAMLSchemaValidation
  115. matrix: >-
  116. ${{ fromJSON(
  117. github.event_name == 'pull_request' && '{
  118. "include": [
  119. {"os": "ubuntu-22.04", "python-version": "3.10", "toxenv": "mypy"},
  120. {"os": "ubuntu-22.04", "python-version": "3.11", "toxenv": "docs"},
  121. {"os": "ubuntu-22.04", "python-version": "3.10", "toxenv": "py310-fuse2"},
  122. {"os": "ubuntu-24.04", "python-version": "3.14", "toxenv": "py314-fuse3"}
  123. ]
  124. }' || '{
  125. "include": [
  126. {"os": "ubuntu-22.04", "python-version": "3.10", "toxenv": "mypy"},
  127. {"os": "ubuntu-22.04", "python-version": "3.11", "toxenv": "docs"},
  128. {"os": "ubuntu-22.04", "python-version": "3.10", "toxenv": "py310-fuse2"},
  129. {"os": "ubuntu-22.04", "python-version": "3.11", "toxenv": "py311-fuse2", "binary": "borg-linux-glibc235-x86_64-gh"},
  130. {"os": "ubuntu-22.04-arm", "python-version": "3.11", "toxenv": "py311-fuse2", "binary": "borg-linux-glibc235-arm64-gh"},
  131. {"os": "ubuntu-24.04", "python-version": "3.12", "toxenv": "py312-fuse3"},
  132. {"os": "ubuntu-24.04", "python-version": "3.13", "toxenv": "py313-fuse3"},
  133. {"os": "ubuntu-24.04", "python-version": "3.14", "toxenv": "py314-fuse3"},
  134. {"os": "macos-13", "python-version": "3.11", "toxenv": "py311-none", "binary": "borg-macos-13-x86_64-gh"},
  135. {"os": "macos-14", "python-version": "3.11", "toxenv": "py311-none", "binary": "borg-macos-14-arm64-gh"}
  136. ]
  137. }'
  138. ) }}
  139. env:
  140. TOXENV: ${{ matrix.toxenv }}
  141. runs-on: ${{ matrix.os }}
  142. timeout-minutes: 120
  143. steps:
  144. - uses: actions/checkout@v4
  145. with:
  146. # Just fetching one commit is not enough for setuptools-scm, so we fetch all.
  147. fetch-depth: 0
  148. fetch-tags: true
  149. - name: Set up Python ${{ matrix.python-version }}
  150. uses: actions/setup-python@v5
  151. with:
  152. python-version: ${{ matrix.python-version }}
  153. - name: Cache pip
  154. uses: actions/cache@v4
  155. with:
  156. path: ~/.cache/pip
  157. key: ${{ runner.os }}-pip-${{ hashFiles('requirements.d/development.txt') }}
  158. restore-keys: |
  159. ${{ runner.os }}-pip-
  160. ${{ runner.os }}-
  161. - name: Install Linux packages
  162. if: ${{ runner.os == 'Linux' }}
  163. run: |
  164. sudo apt-get update
  165. sudo apt-get install -y pkg-config build-essential
  166. sudo apt-get install -y libssl-dev libacl1-dev libxxhash-dev liblz4-dev libzstd-dev
  167. sudo apt-get install -y bash zsh fish # for shell completion tests
  168. sudo apt-get install -y rclone openssh-server curl
  169. if [[ "$TOXENV" == *"fuse2"* ]]; then
  170. sudo apt-get install -y libfuse-dev fuse # Required for Python llfuse module
  171. elif [[ "$TOXENV" == *"fuse3"* ]]; then
  172. sudo apt-get install -y libfuse3-dev fuse3 # Required for Python pyfuse3 module
  173. fi
  174. - name: Install macOS packages
  175. if: ${{ runner.os == 'macOS' }}
  176. run: |
  177. brew unlink pkg-config@0.29.2 || true
  178. brew bundle install
  179. - name: Configure OpenSSH SFTP server (test only)
  180. if: ${{ runner.os == 'Linux' }}
  181. run: |
  182. sudo mkdir -p /run/sshd
  183. sudo useradd -m -s /bin/bash sftpuser || true
  184. # Create SSH key for the CI user and authorize it for sftpuser
  185. mkdir -p ~/.ssh
  186. chmod 700 ~/.ssh
  187. test -f ~/.ssh/id_ed25519 || ssh-keygen -t ed25519 -N '' -f ~/.ssh/id_ed25519
  188. sudo mkdir -p /home/sftpuser/.ssh
  189. sudo chmod 700 /home/sftpuser/.ssh
  190. sudo cp ~/.ssh/id_ed25519.pub /home/sftpuser/.ssh/authorized_keys
  191. sudo chown -R sftpuser:sftpuser /home/sftpuser/.ssh
  192. sudo chmod 600 /home/sftpuser/.ssh/authorized_keys
  193. # Allow publickey auth and enable Subsystem sftp
  194. sudo sed -i 's/^#\?PasswordAuthentication .*/PasswordAuthentication no/' /etc/ssh/sshd_config
  195. sudo sed -i 's/^#\?PubkeyAuthentication .*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
  196. if ! grep -q '^Subsystem sftp' /etc/ssh/sshd_config; then echo 'Subsystem sftp /usr/lib/openssh/sftp-server' | sudo tee -a /etc/ssh/sshd_config; fi
  197. # Ensure host keys exist to avoid slow generation on first sshd start
  198. sudo ssh-keygen -A
  199. # Start sshd (listen on default 22 inside runner)
  200. sudo /usr/sbin/sshd -D &
  201. # Add host key to known_hosts so paramiko trusts it
  202. ssh-keyscan -H localhost 127.0.0.1 | tee -a ~/.ssh/known_hosts
  203. # Start ssh-agent and add our key so paramiko can use the agent
  204. eval "$(ssh-agent -s)"
  205. ssh-add ~/.ssh/id_ed25519
  206. # Export SFTP test URL for tox via GITHUB_ENV
  207. echo "BORG_TEST_SFTP_REPO=sftp://sftpuser@localhost:22/borg/sftp-repo" >> $GITHUB_ENV
  208. - name: Install and configure MinIO S3 server (test only)
  209. if: ${{ runner.os == 'Linux' }}
  210. run: |
  211. set -e
  212. arch=$(uname -m)
  213. case "$arch" in
  214. x86_64|amd64) srv_url=https://dl.min.io/server/minio/release/linux-amd64/minio; cli_url=https://dl.min.io/client/mc/release/linux-amd64/mc ;;
  215. aarch64|arm64) srv_url=https://dl.min.io/server/minio/release/linux-arm64/minio; cli_url=https://dl.min.io/client/mc/release/linux-arm64/mc ;;
  216. *) echo "Unsupported arch: $arch"; exit 1 ;;
  217. esac
  218. curl -fsSL -o /usr/local/bin/minio "$srv_url"
  219. curl -fsSL -o /usr/local/bin/mc "$cli_url"
  220. sudo chmod +x /usr/local/bin/minio /usr/local/bin/mc
  221. export PATH=/usr/local/bin:$PATH
  222. # Start MinIO on :9000 with default credentials (minioadmin/minioadmin)
  223. MINIO_DIR="$GITHUB_WORKSPACE/.minio-data"
  224. MINIO_LOG="$GITHUB_WORKSPACE/.minio.log"
  225. mkdir -p "$MINIO_DIR"
  226. nohup minio server "$MINIO_DIR" --address ":9000" >"$MINIO_LOG" 2>&1 &
  227. # Wait for MinIO port to be ready
  228. for i in $(seq 1 60); do (echo > /dev/tcp/127.0.0.1/9000) >/dev/null 2>&1 && break; sleep 1; done
  229. # Configure client and create bucket
  230. mc alias set local http://127.0.0.1:9000 minioadmin minioadmin
  231. mc mb --ignore-existing local/borg
  232. # Export S3 test URL for tox via GITHUB_ENV
  233. echo "BORG_TEST_S3_REPO=s3:minioadmin:minioadmin@http://127.0.0.1:9000/borg/s3-repo" >> $GITHUB_ENV
  234. - name: Install Python requirements
  235. run: |
  236. python -m pip install --upgrade pip setuptools wheel
  237. pip install -r requirements.d/development.txt
  238. - name: Install borgbackup
  239. run: |
  240. if [[ "$TOXENV" == *"fuse2"* ]]; then
  241. pip install -ve ".[llfuse]"
  242. elif [[ "$TOXENV" == *"fuse3"* ]]; then
  243. pip install -ve ".[pyfuse3]"
  244. else
  245. pip install -ve .
  246. fi
  247. - name: Build Borg fat binaries (${{ matrix.binary }})
  248. if: ${{ matrix.binary && startsWith(github.ref, 'refs/tags/') }}
  249. run: |
  250. pip install 'pyinstaller==6.14.2'
  251. mkdir -p dist/binary
  252. # Ensure locally built binaries in ./dist/binary are found during tox tests
  253. echo "$GITHUB_WORKSPACE/dist/binary" >> "$GITHUB_PATH"
  254. pyinstaller --clean --distpath=dist/binary scripts/borg.exe.spec
  255. - name: Smoke-test the built binary (${{ matrix.binary }})
  256. if: ${{ matrix.binary && startsWith(github.ref, 'refs/tags/') }}
  257. run: |
  258. pushd dist/binary
  259. echo "single-file binary"
  260. chmod +x borg.exe
  261. ./borg.exe -V
  262. echo "single-directory binary"
  263. chmod +x borg-dir/borg.exe
  264. ./borg-dir/borg.exe -V
  265. tar czf borg.tgz borg-dir
  266. popd
  267. echo "borg.exe binary in PATH"
  268. borg.exe -V
  269. - name: Prepare binaries (${{ matrix.binary }})
  270. if: ${{ matrix.binary && startsWith(github.ref, 'refs/tags/') }}
  271. run: |
  272. mkdir -p artifacts
  273. if [ -f dist/binary/borg.exe ]; then
  274. cp dist/binary/borg.exe artifacts/${{ matrix.binary }}
  275. fi
  276. if [ -f dist/binary/borg.tgz ]; then
  277. cp dist/binary/borg.tgz artifacts/${{ matrix.binary }}.tgz
  278. fi
  279. echo "binary files"
  280. ls -l artifacts/
  281. - name: Attest binaries provenance (${{ matrix.binary }})
  282. if: ${{ matrix.binary && startsWith(github.ref, 'refs/tags/') }}
  283. uses: actions/attest-build-provenance@v3
  284. with:
  285. subject-path: 'artifacts/*'
  286. - name: Upload binaries (${{ matrix.binary }})
  287. if: ${{ matrix.binary && startsWith(github.ref, 'refs/tags/') }}
  288. uses: actions/upload-artifact@v4
  289. with:
  290. name: ${{ matrix.binary }}
  291. path: artifacts/*
  292. if-no-files-found: error
  293. - name: run tox env
  294. run: |
  295. # do not use fakeroot, but run as root. avoids the dreaded EISDIR sporadic failures. see #2482.
  296. #sudo -E bash -c "tox -e py"
  297. tox --skip-missing-interpreters
  298. - name: Upload coverage to Codecov
  299. uses: codecov/codecov-action@v4
  300. env:
  301. OS: ${{ runner.os }}
  302. python: ${{ matrix.python-version }}
  303. with:
  304. token: ${{ secrets.CODECOV_TOKEN }}
  305. env_vars: OS, python
  306. vm_tests:
  307. permissions:
  308. contents: read
  309. id-token: write
  310. attestations: write
  311. runs-on: ubuntu-24.04
  312. timeout-minutes: 90
  313. needs: [lint, security]
  314. continue-on-error: true
  315. strategy:
  316. fail-fast: false
  317. matrix:
  318. include:
  319. - os: freebsd
  320. version: '14.3'
  321. display_name: FreeBSD
  322. # Controls binary build and provenance attestation on tags
  323. do_binaries: true
  324. artifact_prefix: borg-freebsd-14-x86_64-gh
  325. - os: netbsd
  326. version: '10.1'
  327. display_name: NetBSD
  328. do_binaries: false
  329. - os: openbsd
  330. version: '7.7'
  331. display_name: OpenBSD
  332. do_binaries: false
  333. - os: haiku
  334. version: 'r1beta5'
  335. display_name: Haiku
  336. do_binaries: false
  337. steps:
  338. - name: Check out repository
  339. uses: actions/checkout@v4
  340. with:
  341. fetch-depth: 0
  342. fetch-tags: true
  343. - name: Test on ${{ matrix.display_name }}
  344. id: cross_os
  345. uses: cross-platform-actions/action@v0.29.0
  346. env:
  347. DO_BINARIES: ${{ matrix.do_binaries }}
  348. with:
  349. operating_system: ${{ matrix.os }}
  350. version: ${{ matrix.version }}
  351. shell: bash
  352. run: |
  353. set -euxo pipefail
  354. case "${{ matrix.os }}" in
  355. freebsd)
  356. export IGNORE_OSVERSION=yes
  357. sudo -E pkg update -f
  358. sudo -E pkg install -y xxhash liblz4 zstd pkgconf
  359. sudo -E pkg install -y fusefs-libs
  360. sudo -E kldload fusefs
  361. sudo -E sysctl vfs.usermount=1
  362. sudo -E chmod 666 /dev/fuse
  363. sudo -E pkg install -y rust
  364. sudo -E pkg install -y gmake
  365. sudo -E pkg install -y git
  366. sudo -E pkg install -y python310 py310-sqlite3
  367. sudo -E pkg install -y python311 py311-sqlite3 py311-pip py311-virtualenv
  368. sudo ln -sf /usr/local/bin/python3.11 /usr/local/bin/python3
  369. sudo ln -sf /usr/local/bin/python3.11 /usr/local/bin/python
  370. sudo ln -sf /usr/local/bin/pip3.11 /usr/local/bin/pip3
  371. sudo ln -sf /usr/local/bin/pip3.11 /usr/local/bin/pip
  372. # required for libsodium/pynacl build
  373. export MAKE=gmake
  374. python -m venv .venv
  375. . .venv/bin/activate
  376. python -V
  377. pip -V
  378. python -m pip install --upgrade pip wheel
  379. pip install -r requirements.d/development.txt
  380. pip install -e ".[llfuse]"
  381. tox -e py311-fuse2
  382. if [[ "${{ matrix.do_binaries }}" == "true" && "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
  383. python -m pip install 'pyinstaller==6.14.2'
  384. mkdir -p dist/binary
  385. pyinstaller --clean --distpath=dist/binary scripts/borg.exe.spec
  386. pushd dist/binary
  387. echo "single-file binary"
  388. chmod +x borg.exe
  389. ./borg.exe -V
  390. echo "single-directory binary"
  391. chmod +x borg-dir/borg.exe
  392. ./borg-dir/borg.exe -V
  393. tar czf borg.tgz borg-dir
  394. popd
  395. mkdir -p artifacts
  396. if [ -f dist/binary/borg.exe ]; then
  397. cp -v dist/binary/borg.exe artifacts/${{ matrix.artifact_prefix }}
  398. fi
  399. if [ -f dist/binary/borg.tgz ]; then
  400. cp -v dist/binary/borg.tgz artifacts/${{ matrix.artifact_prefix }}.tgz
  401. fi
  402. fi
  403. ;;
  404. netbsd)
  405. arch="$(uname -m)"
  406. sudo -E mkdir -p /usr/pkg/etc/pkgin
  407. echo "http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/${arch}/10.1/All" | sudo tee /usr/pkg/etc/pkgin/repositories.conf > /dev/null
  408. sudo -E pkgin update
  409. sudo -E pkgin -y upgrade
  410. sudo -E pkgin -y install zstd lz4 xxhash git
  411. sudo -E pkgin -y install rust
  412. sudo -E pkgin -y install pkg-config
  413. sudo -E pkgin -y install py311-pip py311-virtualenv py311-tox
  414. sudo -E ln -sf /usr/pkg/bin/python3.11 /usr/pkg/bin/python3
  415. sudo -E ln -sf /usr/pkg/bin/pip3.11 /usr/pkg/bin/pip3
  416. sudo -E ln -sf /usr/pkg/bin/virtualenv-3.11 /usr/pkg/bin/virtualenv3
  417. sudo -E ln -sf /usr/pkg/bin/tox-3.11 /usr/pkg/bin/tox3
  418. # Ensure base system admin tools are on PATH for the non-root shell
  419. export PATH="/sbin:/usr/sbin:$PATH"
  420. echo "--- Preparing an extattr-enabled filesystem ---"
  421. # On many NetBSD setups /tmp is tmpfs without extended attributes.
  422. # Create a FFS image with extended attributes enabled and use it for TMPDIR.
  423. VNDDEV="vnd0"
  424. IMGFILE="/tmp/fs.img"
  425. sudo -E dd if=/dev/zero of=${IMGFILE} bs=1m count=1024
  426. sudo -E vndconfig -c "${VNDDEV}" "${IMGFILE}"
  427. sudo -E newfs -O 2ea /dev/r${VNDDEV}a
  428. MNT="/mnt/eafs"
  429. sudo -E mkdir -p ${MNT}
  430. sudo -E mount -t ffs -o extattr /dev/${VNDDEV}a $MNT
  431. export TMPDIR="${MNT}/tmp"
  432. sudo -E mkdir -p ${TMPDIR}
  433. sudo -E chmod 1777 ${TMPDIR}
  434. touch ${TMPDIR}/testfile
  435. lsextattr user ${TMPDIR}/testfile && echo "[xattr] *** xattrs SUPPORTED on ${TMPDIR}! ***"
  436. tox3 -e py311-none
  437. ;;
  438. openbsd)
  439. sudo -E pkg_add xxhash lz4 zstd git
  440. sudo -E pkg_add rust
  441. sudo -E pkg_add openssl%3.4
  442. sudo -E pkg_add py3-pip py3-virtualenv py3-tox
  443. export BORG_OPENSSL_NAME=eopenssl34
  444. tox -e py312-none
  445. ;;
  446. haiku)
  447. pkgman refresh
  448. pkgman install -y git pkgconfig zstd lz4 xxhash
  449. pkgman install -y openssl3
  450. pkgman install -y rust_bin
  451. pkgman install -y python3.10
  452. pkgman install -y cffi
  453. pkgman install -y lz4_devel zstd_devel xxhash_devel openssl3_devel libffi_devel
  454. # there is no pkgman package for tox, so we install it into a venv
  455. python3 -m ensurepip --upgrade
  456. python3 -m pip install --upgrade pip wheel
  457. python3 -m venv .venv
  458. . .venv/bin/activate
  459. export PKG_CONFIG_PATH="/system/develop/lib/pkgconfig:/system/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
  460. export BORG_LIBLZ4_PREFIX=/system/develop
  461. export BORG_LIBZSTD_PREFIX=/system/develop
  462. export BORG_LIBXXHASH_PREFIX=/system/develop
  463. export BORG_OPENSSL_PREFIX=/system/develop
  464. pip install -r requirements.d/development.txt
  465. pip install -e .
  466. # troubles with either tox or pytest xdist, so we run pytest manually:
  467. pytest -v -rs --benchmark-skip -k "not remote and not socket"
  468. ;;
  469. esac
  470. - name: Upload artifacts
  471. if: startsWith(github.ref, 'refs/tags/') && matrix.do_binaries
  472. uses: actions/upload-artifact@v4
  473. with:
  474. name: ${{ matrix.os }}-${{ matrix.version }}-dist
  475. path: artifacts/*
  476. if-no-files-found: ignore
  477. - name: Attest provenance
  478. if: startsWith(github.ref, 'refs/tags/') && matrix.do_binaries
  479. uses: actions/attest-build-provenance@v3
  480. with:
  481. subject-path: 'artifacts/*'
  482. windows_tests:
  483. if: false # can be used to temporarily disable the build
  484. runs-on: windows-latest
  485. timeout-minutes: 120
  486. needs: native_tests
  487. env:
  488. PY_COLORS: 1
  489. defaults:
  490. run:
  491. shell: msys2 {0}
  492. steps:
  493. - uses: actions/checkout@v4
  494. with:
  495. fetch-depth: 0
  496. - uses: msys2/setup-msys2@v2
  497. with:
  498. msystem: UCRT64
  499. update: true
  500. - name: Install system packages
  501. run: ./scripts/msys2-install-deps development
  502. - name: Build python venv
  503. run: |
  504. # building cffi / argon2-cffi in the venv fails, so we try to use the system packages
  505. python -m venv --system-site-packages env
  506. . env/bin/activate
  507. # python -m pip install --upgrade pip
  508. # pip install --upgrade setuptools build wheel
  509. pip install pyinstaller==6.14.2
  510. - name: Build
  511. run: |
  512. # build borg.exe
  513. . env/bin/activate
  514. pip install -e .
  515. pyinstaller -y scripts/borg.exe.spec
  516. # build sdist and wheel in dist/...
  517. python -m build
  518. - uses: actions/upload-artifact@v4
  519. with:
  520. name: borg-windows
  521. path: dist/borg.exe
  522. - name: Run tests
  523. run: |
  524. ./dist/borg.exe -V
  525. . env/bin/activate
  526. borg -V
  527. python -m pytest -n4 --benchmark-skip -vv -rs -k "not remote"
  528. - name: Upload coverage to Codecov
  529. uses: codecov/codecov-action@v4
  530. env:
  531. OS: ${{ runner.os }}
  532. python: '3.11'
  533. with:
  534. token: ${{ secrets.CODECOV_TOKEN }}
  535. env_vars: OS, python