tests: fix and enable windows CI, fixes #8728

thanks a lot to @sothix for helping with this!

removed pytest-forked, is not found anymore:
error: target not found: mingw-w64-ucrt-x86_64-python-pytest-forked

use a virtual env to avoid mixup of user with system packages.

remove old workaround for setuptools (SETUPTOOLS_USE_DISTUTILS: stdlib).

fix pip install

use --system-site-packages as a workaround for broken pip install python-cffi.

do not upgrade pip setuptools build wheel

use python -m pytest to use the one from the venv
This commit is contained in:
Thomas Waldmann 2025-05-18 07:10:55 +02:00
parent 15e55bfd2e
commit 3df7702519
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01
2 changed files with 15 additions and 8 deletions

View file

@ -195,14 +195,12 @@ jobs:
windows:
if: false # build temporary disabled
if: true # can be used to temporary disable build
runs-on: windows-latest
timeout-minutes: 120
needs: linux
env:
# Needed for setuptools < 70.2.0 to work, see: https://www.msys2.org/docs/python/#known-issues
# SETUPTOOLS_USE_DISTUTILS: stdlib
PY_COLORS: 1
defaults:
@ -217,11 +215,20 @@ jobs:
with:
msystem: UCRT64
update: true
- name: Install dependencies
- name: Install system packages
run: ./scripts/msys2-install-deps development
- name: Build python venv
run: |
# building cffi / argon2-cffi in the venv fails, so we try to use the system packages
python -m venv --system-site-packages env
. env/bin/activate
# python -m pip install --upgrade pip
# pip install --upgrade setuptools build wheel
pip install pyinstaller==6.11.1
- name: Build
run: |
# build borg.exe
. env/bin/activate
pip install -e .
pyinstaller -y scripts/borg.exe.spec
# build sdist and wheel in dist/...
@ -233,4 +240,6 @@ jobs:
- name: Run tests
run: |
./dist/borg.exe -V
pytest -n4 --benchmark-skip -vv -rs -k "not remote"
. env/bin/activate
borg -V
python -m pytest -n4 --benchmark-skip -vv -rs -k "not remote"

View file

@ -1,9 +1,7 @@
#!/bin/bash
pacman -S --needed --noconfirm git mingw-w64-ucrt-x86_64-{toolchain,pkgconf,zstd,lz4,xxhash,openssl,rclone,python-msgpack,python-argon2_cffi,python-platformdirs,python,cython,python-setuptools,python-wheel,python-build,python-pkgconfig,python-packaging,python-pip,python-paramiko}
python -m pip install --upgrade pip
pip install pyinstaller==6.11.1
if [ "$1" = "development" ]; then
pacman -S --needed --noconfirm mingw-w64-ucrt-x86_64-python-{pytest,pytest-benchmark,pytest-cov,pytest-forked,pytest-xdist}
pacman -S --needed --noconfirm mingw-w64-ucrt-x86_64-python-{pytest,pytest-benchmark,pytest-cov,pytest-xdist}
fi