ci.yml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  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 libfuse-dev fuse || true # Required for Python llfuse module
  168. sudo apt-get install -y libfuse3-dev fuse3 || true # Required for Python pyfuse3 module
  169. sudo apt-get install -y bash zsh fish # for shell completion tests
  170. sudo apt-get install -y rclone openssh-server curl
  171. - name: Install macOS packages
  172. if: ${{ runner.os == 'macOS' }}
  173. run: |
  174. brew unlink pkg-config@0.29.2 || true
  175. brew bundle install
  176. - name: Configure OpenSSH SFTP server (test only)
  177. if: ${{ runner.os == 'Linux' }}
  178. run: |
  179. sudo mkdir -p /run/sshd
  180. sudo useradd -m -s /bin/bash sftpuser || true
  181. # Create SSH key for the CI user and authorize it for sftpuser
  182. mkdir -p ~/.ssh
  183. chmod 700 ~/.ssh
  184. test -f ~/.ssh/id_ed25519 || ssh-keygen -t ed25519 -N '' -f ~/.ssh/id_ed25519
  185. sudo mkdir -p /home/sftpuser/.ssh
  186. sudo chmod 700 /home/sftpuser/.ssh
  187. sudo cp ~/.ssh/id_ed25519.pub /home/sftpuser/.ssh/authorized_keys
  188. sudo chown -R sftpuser:sftpuser /home/sftpuser/.ssh
  189. sudo chmod 600 /home/sftpuser/.ssh/authorized_keys
  190. # Allow publickey auth and enable Subsystem sftp
  191. sudo sed -i 's/^#\?PasswordAuthentication .*/PasswordAuthentication no/' /etc/ssh/sshd_config
  192. sudo sed -i 's/^#\?PubkeyAuthentication .*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
  193. 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
  194. # Ensure host keys exist to avoid slow generation on first sshd start
  195. sudo ssh-keygen -A
  196. # Start sshd (listen on default 22 inside runner)
  197. sudo /usr/sbin/sshd -D &
  198. # Add host key to known_hosts so paramiko trusts it
  199. ssh-keyscan -H localhost 127.0.0.1 | tee -a ~/.ssh/known_hosts
  200. # Start ssh-agent and add our key so paramiko can use the agent
  201. eval "$(ssh-agent -s)"
  202. ssh-add ~/.ssh/id_ed25519
  203. # Export SFTP test URL for tox via GITHUB_ENV
  204. echo "BORG_TEST_SFTP_REPO=sftp://sftpuser@localhost:22/borg/sftp-repo" >> $GITHUB_ENV
  205. - name: Install and configure MinIO S3 server (test only)
  206. if: ${{ runner.os == 'Linux' }}
  207. run: |
  208. set -e
  209. arch=$(uname -m)
  210. case "$arch" in
  211. 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 ;;
  212. 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 ;;
  213. *) echo "Unsupported arch: $arch"; exit 1 ;;
  214. esac
  215. curl -fsSL -o /usr/local/bin/minio "$srv_url"
  216. curl -fsSL -o /usr/local/bin/mc "$cli_url"
  217. sudo chmod +x /usr/local/bin/minio /usr/local/bin/mc
  218. export PATH=/usr/local/bin:$PATH
  219. # Start MinIO on :9000 with default credentials (minioadmin/minioadmin)
  220. MINIO_DIR="$GITHUB_WORKSPACE/.minio-data"
  221. MINIO_LOG="$GITHUB_WORKSPACE/.minio.log"
  222. mkdir -p "$MINIO_DIR"
  223. nohup minio server "$MINIO_DIR" --address ":9000" >"$MINIO_LOG" 2>&1 &
  224. # Wait for MinIO port to be ready
  225. for i in $(seq 1 60); do (echo > /dev/tcp/127.0.0.1/9000) >/dev/null 2>&1 && break; sleep 1; done
  226. # Configure client and create bucket
  227. mc alias set local http://127.0.0.1:9000 minioadmin minioadmin
  228. mc mb --ignore-existing local/borg
  229. # Export S3 test URL for tox via GITHUB_ENV
  230. echo "BORG_TEST_S3_REPO=s3:minioadmin:minioadmin@http://127.0.0.1:9000/borg/s3-repo" >> $GITHUB_ENV
  231. - name: Install Python requirements
  232. run: |
  233. python -m pip install --upgrade pip setuptools wheel
  234. pip install -r requirements.d/development.txt
  235. - name: Install borgbackup
  236. run: |
  237. pip install -e .
  238. - name: run tox env
  239. run: |
  240. # do not use fakeroot, but run as root. avoids the dreaded EISDIR sporadic failures. see #2482.
  241. #sudo -E bash -c "tox -e py"
  242. tox --skip-missing-interpreters
  243. - name: Upload coverage to Codecov
  244. uses: codecov/codecov-action@v4
  245. env:
  246. OS: ${{ runner.os }}
  247. python: ${{ matrix.python-version }}
  248. with:
  249. token: ${{ secrets.CODECOV_TOKEN }}
  250. env_vars: OS, python
  251. - name: Build Borg fat binaries (${{ matrix.binary }})
  252. if: ${{ matrix.binary && startsWith(github.ref, 'refs/tags/') }}
  253. run: |
  254. pip install 'pyinstaller==6.14.2'
  255. mkdir -p dist/binary
  256. pyinstaller --clean --distpath=dist/binary scripts/borg.exe.spec
  257. - name: Smoke-test the built binary (${{ matrix.binary }})
  258. if: ${{ matrix.binary && startsWith(github.ref, 'refs/tags/') }}
  259. run: |
  260. pushd dist/binary
  261. echo "single-file binary"
  262. chmod +x borg.exe
  263. ./borg.exe -V
  264. echo "single-directory binary"
  265. chmod +x borg-dir/borg.exe
  266. ./borg-dir/borg.exe -V
  267. tar czf borg.tgz borg-dir
  268. popd
  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. vm_tests:
  294. permissions:
  295. contents: read
  296. id-token: write
  297. attestations: write
  298. runs-on: ubuntu-24.04
  299. timeout-minutes: 90
  300. needs: [lint, security]
  301. continue-on-error: true
  302. strategy:
  303. fail-fast: false
  304. matrix:
  305. include:
  306. - os: freebsd
  307. version: '14.3'
  308. display_name: FreeBSD
  309. # Controls binary build and provenance attestation on tags
  310. do_binaries: true
  311. artifact_prefix: borg-freebsd-14-x86_64-gh
  312. - os: netbsd
  313. version: '10.1'
  314. display_name: NetBSD
  315. do_binaries: false
  316. - os: openbsd
  317. version: '7.7'
  318. display_name: OpenBSD
  319. do_binaries: false
  320. - os: haiku
  321. version: 'r1beta5'
  322. display_name: Haiku
  323. do_binaries: false
  324. steps:
  325. - name: Check out repository
  326. uses: actions/checkout@v4
  327. with:
  328. fetch-depth: 0
  329. fetch-tags: true
  330. - name: Test on ${{ matrix.display_name }}
  331. id: cross_os
  332. uses: cross-platform-actions/action@v0.29.0
  333. env:
  334. DO_BINARIES: ${{ matrix.do_binaries }}
  335. with:
  336. operating_system: ${{ matrix.os }}
  337. version: ${{ matrix.version }}
  338. shell: bash
  339. run: |
  340. set -euxo pipefail
  341. case "${{ matrix.os }}" in
  342. freebsd)
  343. export IGNORE_OSVERSION=yes
  344. sudo -E pkg update -f
  345. sudo -E pkg install -y xxhash liblz4 zstd pkgconf
  346. # Install one of the FUSE libraries; fail if neither is available
  347. sudo -E pkg install -y fusefs-libs || sudo -E pkg install -y fusefs-libs3
  348. sudo -E pkg install -y rust
  349. sudo -E pkg install -y gmake
  350. sudo -E pkg install -y git
  351. sudo -E pkg install -y python310 py310-sqlite3
  352. sudo -E pkg install -y python311 py311-sqlite3 py311-pip py311-virtualenv
  353. sudo ln -sf /usr/local/bin/python3.11 /usr/local/bin/python3
  354. sudo ln -sf /usr/local/bin/python3.11 /usr/local/bin/python
  355. sudo ln -sf /usr/local/bin/pip3.11 /usr/local/bin/pip3
  356. sudo ln -sf /usr/local/bin/pip3.11 /usr/local/bin/pip
  357. # required for libsodium/pynacl build
  358. export MAKE=gmake
  359. python -m venv .venv
  360. . .venv/bin/activate
  361. python -V
  362. pip -V
  363. python -m pip install --upgrade pip wheel
  364. pip install -r requirements.d/development.txt
  365. pip install -e .
  366. tox -e py311-none
  367. if [[ "${{ matrix.do_binaries }}" == "true" && "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
  368. python -m pip install 'pyinstaller==6.14.2'
  369. mkdir -p dist/binary
  370. pyinstaller --clean --distpath=dist/binary scripts/borg.exe.spec
  371. pushd dist/binary
  372. echo "single-file binary"
  373. chmod +x borg.exe
  374. ./borg.exe -V
  375. echo "single-directory binary"
  376. chmod +x borg-dir/borg.exe
  377. ./borg-dir/borg.exe -V
  378. tar czf borg.tgz borg-dir
  379. popd
  380. mkdir -p artifacts
  381. if [ -f dist/binary/borg.exe ]; then
  382. cp -v dist/binary/borg.exe artifacts/${{ matrix.artifact_prefix }}
  383. fi
  384. if [ -f dist/binary/borg.tgz ]; then
  385. cp -v dist/binary/borg.tgz artifacts/${{ matrix.artifact_prefix }}.tgz
  386. fi
  387. fi
  388. ;;
  389. netbsd)
  390. arch="$(uname -m)"
  391. sudo -E mkdir -p /usr/pkg/etc/pkgin
  392. echo "http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/${arch}/10.1/All" | sudo tee /usr/pkg/etc/pkgin/repositories.conf > /dev/null
  393. sudo -E pkgin update
  394. sudo -E pkgin -y upgrade
  395. sudo -E pkgin -y install zstd lz4 xxhash git
  396. sudo -E pkgin -y install rust
  397. sudo -E pkgin -y install pkg-config
  398. sudo -E pkgin -y install py311-pip py311-virtualenv py311-tox
  399. sudo -E ln -sf /usr/pkg/bin/python3.11 /usr/pkg/bin/python3
  400. sudo -E ln -sf /usr/pkg/bin/pip3.11 /usr/pkg/bin/pip3
  401. sudo -E ln -sf /usr/pkg/bin/virtualenv-3.11 /usr/pkg/bin/virtualenv3
  402. sudo -E ln -sf /usr/pkg/bin/tox-3.11 /usr/pkg/bin/tox3
  403. # Ensure base system admin tools are on PATH for the non-root shell
  404. export PATH="/sbin:/usr/sbin:$PATH"
  405. echo "--- Preparing an extattr-enabled filesystem ---"
  406. # On many NetBSD setups /tmp is tmpfs without extended attributes.
  407. # Create a FFS image with extended attributes enabled and use it for TMPDIR.
  408. VNDDEV="vnd0"
  409. IMGFILE="/tmp/fs.img"
  410. sudo -E dd if=/dev/zero of=${IMGFILE} bs=1m count=1024
  411. sudo -E vndconfig -c "${VNDDEV}" "${IMGFILE}"
  412. sudo -E newfs -O 2ea /dev/r${VNDDEV}a
  413. MNT="/mnt/eafs"
  414. sudo -E mkdir -p ${MNT}
  415. sudo -E mount -t ffs -o extattr /dev/${VNDDEV}a $MNT
  416. export TMPDIR="${MNT}/tmp"
  417. sudo -E mkdir -p ${TMPDIR}
  418. sudo -E chmod 1777 ${TMPDIR}
  419. touch ${TMPDIR}/testfile
  420. lsextattr user ${TMPDIR}/testfile && echo "[xattr] *** xattrs SUPPORTED on ${TMPDIR}! ***"
  421. tox3 -e py311-none
  422. ;;
  423. openbsd)
  424. sudo -E pkg_add xxhash lz4 zstd git
  425. sudo -E pkg_add rust
  426. sudo -E pkg_add openssl%3.4
  427. sudo -E pkg_add py3-pip py3-virtualenv py3-tox
  428. export BORG_OPENSSL_NAME=eopenssl34
  429. tox -e py312-none
  430. ;;
  431. haiku)
  432. pkgman refresh
  433. pkgman install -y git pkgconfig zstd lz4 xxhash
  434. pkgman install -y openssl3
  435. pkgman install -y rust_bin
  436. pkgman install -y python3.10
  437. pkgman install -y cffi
  438. pkgman install -y lz4_devel zstd_devel xxhash_devel openssl3_devel libffi_devel
  439. # there is no pkgman package for tox, so we install it into a venv
  440. python3 -m ensurepip --upgrade
  441. python3 -m pip install --upgrade pip wheel
  442. python3 -m venv .venv
  443. . .venv/bin/activate
  444. export PKG_CONFIG_PATH="/system/develop/lib/pkgconfig:/system/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
  445. export BORG_LIBLZ4_PREFIX=/system/develop
  446. export BORG_LIBZSTD_PREFIX=/system/develop
  447. export BORG_LIBXXHASH_PREFIX=/system/develop
  448. export BORG_OPENSSL_PREFIX=/system/develop
  449. pip install -r requirements.d/development.txt
  450. pip install -e .
  451. # troubles with either tox or pytest xdist, so we run pytest manually:
  452. pytest -v -rs --benchmark-skip -k "not remote and not socket"
  453. ;;
  454. esac
  455. - name: Upload artifacts
  456. if: startsWith(github.ref, 'refs/tags/') && matrix.do_binaries
  457. uses: actions/upload-artifact@v4
  458. with:
  459. name: ${{ matrix.os }}-${{ matrix.version }}-dist
  460. path: artifacts/*
  461. if-no-files-found: ignore
  462. - name: Attest provenance
  463. if: startsWith(github.ref, 'refs/tags/') && matrix.do_binaries
  464. uses: actions/attest-build-provenance@v3
  465. with:
  466. subject-path: 'artifacts/*'
  467. windows_tests:
  468. if: false # can be used to temporarily disable the build
  469. runs-on: windows-latest
  470. timeout-minutes: 120
  471. needs: native_tests
  472. env:
  473. PY_COLORS: 1
  474. defaults:
  475. run:
  476. shell: msys2 {0}
  477. steps:
  478. - uses: actions/checkout@v4
  479. with:
  480. fetch-depth: 0
  481. - uses: msys2/setup-msys2@v2
  482. with:
  483. msystem: UCRT64
  484. update: true
  485. - name: Install system packages
  486. run: ./scripts/msys2-install-deps development
  487. - name: Build python venv
  488. run: |
  489. # building cffi / argon2-cffi in the venv fails, so we try to use the system packages
  490. python -m venv --system-site-packages env
  491. . env/bin/activate
  492. # python -m pip install --upgrade pip
  493. # pip install --upgrade setuptools build wheel
  494. pip install pyinstaller==6.14.2
  495. - name: Build
  496. run: |
  497. # build borg.exe
  498. . env/bin/activate
  499. pip install -e .
  500. pyinstaller -y scripts/borg.exe.spec
  501. # build sdist and wheel in dist/...
  502. python -m build
  503. - uses: actions/upload-artifact@v4
  504. with:
  505. name: borg-windows
  506. path: dist/borg.exe
  507. - name: Run tests
  508. run: |
  509. ./dist/borg.exe -V
  510. . env/bin/activate
  511. borg -V
  512. python -m pytest -n4 --benchmark-skip -vv -rs -k "not remote"
  513. - name: Upload coverage to Codecov
  514. uses: codecov/codecov-action@v4
  515. env:
  516. OS: ${{ runner.os }}
  517. python: '3.11'
  518. with:
  519. token: ${{ secrets.CODECOV_TOKEN }}
  520. env_vars: OS, python