Skip to content

Commit 0af25b3

Browse files
committed
Generate .coverage per matrix os
1 parent aabe766 commit 0af25b3

7 files changed

Lines changed: 68 additions & 58 deletions

File tree

.github/workflows/main.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ jobs:
5252
version: "0.8.3"
5353
enable-cache: false
5454

55-
- name: Test all python/qt combinations
55+
- name: Test python/qt combinations
5656
uses: coactions/setup-xvfb@v1
57+
env:
58+
GITHUB_MATRIX_OS: ${{ matrix.os }}
5759
with:
58-
run: bash scripts/test.sh
60+
run: bash scripts/test-matrix.sh
5961

6062
# combine-coverage:
6163
# needs: tests

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ _build
2222
*.so
2323

2424
# testing / coverage
25-
.coverage
25+
.coverage*
26+
coverage.xml
2627
.pytest_cache
2728
.ruff_cache

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ dev = [
4545
"pytest==7.4; python_version<'3.9'",
4646
"coverage==7.6.1; python_version<'3.9'",
4747
]
48-
# only used in github actions
49-
ci = ["pytest-github-actions-annotate-failures>=0.1.7"]
5048

5149
[project.urls]
5250
Homepage = "https://github.com/CabbageDevelopment/qasync"
@@ -68,5 +66,6 @@ testpaths = ["tests"]
6866

6967
[tool.coverage.run]
7068
parallel = true
69+
command_line = "--module pytest --verbose tests/"
7170
source = ["src", "tests"]
7271
omit = ["tests/conftest.py"]

scripts/test-combo.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
PY="$1"
6+
QT="$2"
7+
8+
echo "Testing qasync combo $PY-$QT"
9+
VIRTUAL_ENV=".venvs/$PY-$QT" QT_API="$QT" uv run --active coverage run --context="$PY-$QT"

scripts/test-matrix.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
PYTHON_VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12" "3.13")
6+
QT_VERSIONS=("pyside2" "pyside6" "pyqt5" "pyqt6")
7+
OS_NAME="${GITHUB_MATRIX_OS:-$(uname | tr '[:upper:]' '[:lower:]')}"
8+
9+
TEST_MATRIX=()
10+
for PY in "${PYTHON_VERSIONS[@]}"; do
11+
for QT in "${QT_VERSIONS[@]}"; do
12+
if [[ "$QT" == "pyside2" && ("$PY" == "3.11" || "$PY" == "3.12" || "$PY" == "3.13") ]]; then
13+
echo "$QT skipping $PY (requires <3.11)"
14+
continue
15+
fi
16+
if [[ "$QT" == "pyside2" && "$OS_NAME" == "darwin" && "$(uname -m)" == "arm64" ]]; then
17+
echo "$QT skipping $OS_NAME (does not publish arm64 packages)"
18+
continue
19+
fi
20+
if [[ "$QT" == "pyside6" || "$QT" == "pyqt6" ]] && [[ "$PY" == "3.8" ]]; then
21+
echo "$QT skipping $PY (requires >=3.9)"
22+
continue
23+
fi
24+
25+
export VIRTUAL_ENV=".venvs/$PY-$QT"
26+
echo "Preparing $VIRTUAL_ENV"
27+
uv venv --clear --no-config --no-project --python "$PY" "$VIRTUAL_ENV"
28+
29+
echo "Installing qasync dependencies to $VIRTUAL_ENV"
30+
uv sync --locked --active --group dev
31+
32+
echo "Installing qt library $QT"
33+
uv pip install "$QT"
34+
35+
TEST_MATRIX+=("$PY $QT")
36+
done
37+
done
38+
39+
# run sequential
40+
# for COMBO in "${TEST_MATRIX[@]}"; do
41+
# read -r PY QT <<<"$COMBO"
42+
# echo "Testing qasync combo $PY-$QT"
43+
# VIRTUAL_ENV=".venvs/$PY-$QT" QT_API="$QT" uv run --active coverage run --context="$PY-$QT"
44+
# done
45+
46+
# run in parallel
47+
printf "%s\n" "${TEST_MATRIX[@]}" | xargs -n2 -P4 scripts/test-combo.sh
48+
49+
# combine coverage
50+
uv run --active coverage combine --quiet
51+
uv run --active coverage report --sort=cover --show-missing
52+
# uv run --active coverage report --sort=cover --show-missing xml coverage.xml

scripts/test.sh

Lines changed: 0 additions & 36 deletions
This file was deleted.

uv.lock

Lines changed: 0 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)