Skip to content

Commit 55f3795

Browse files
committed
Combine coverages for matrix.os
1 parent e57abc9 commit 55f3795

2 files changed

Lines changed: 51 additions & 23 deletions

File tree

.github/workflows/main.yml

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,57 @@ jobs:
5050
uses: astral-sh/setup-uv@v6
5151
with:
5252
version: "0.8.3"
53-
enable-cache: false
53+
enable-cache: true
5454

5555
- name: Test python/qt combinations
5656
uses: coactions/setup-xvfb@v1
5757
with:
58-
run: bash scripts/test-matrix.sh
58+
run: bash scripts/test-matrix.sh --parallel
5959

60-
# combine-coverage:
61-
# needs: tests
62-
# name: combine and report coverage
63-
# runs-on: ubuntu-latest
64-
#
65-
# steps:
66-
# - uses: actions/checkout@v4
67-
# - run: pip install coverage
68-
#
69-
# - name: Download all coverage artifacts
70-
# uses: actions/download-artifact@v4
71-
# with:
72-
# path: coverage-artifacts
73-
#
74-
# - name: Comment with coverage report
75-
# uses: MishaKav/pytest-coverage-comment@v1
60+
- name: Collect test coverage
61+
run: |
62+
uv run coverage combine --quiet
63+
uv run coverage report --sort=cover
64+
mv .coverage .coverage-${{ matrix.os }}
65+
66+
- name: Upload coverage artifacts
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: coverage-${{ matrix.os }}
70+
path: .coverage-${{ matrix.os }}
71+
include-hidden-files: true
72+
73+
combine-coverage:
74+
needs: tests
75+
name: combine and report test coverage
76+
runs-on: ubuntu-latest
77+
permissions:
78+
# new comments in pull requests
79+
pull-requests: write
80+
# permissions for pushing to python-coverage-comment-action branch
81+
# for editing existing comments
82+
contents: write
83+
84+
steps:
85+
- name: Checkout
86+
uses: actions/checkout@v4
87+
88+
- name: Download coverage artifacts
89+
uses: actions/download-artifact@v4
90+
with:
91+
pattern: coverage-*
92+
merge-multiple: true
93+
94+
- name: Coverage report
95+
uses: py-cov-action/python-coverage-comment-action@v3.35
96+
with:
97+
GITHUB_TOKEN: ${{ github.token }}
98+
MERGE_COVERAGE_FILES: true
99+
100+
# - name: Collect test coverage
101+
# run: |
102+
# pip install coverage
103+
# coverage combine --quiet coverage/
104+
105+
# - name: Comment with coverage report
106+
# uses: MishaKav/pytest-coverage-comment@v1

scripts/test-matrix.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ QT_VERSIONS=("pyside2" "pyside6" "pyqt5" "pyqt6")
77
TARGET_OS="${GITHUB_MATRIX_OS:-$(uname | tr '[:upper:]' '[:lower:]')}"
88
TARGET_ARCH="${GITHUB_MATRIX_ARCH:-$(uname -m)}"
99

10+
echo "Running on $TARGET_OS-$TARGET_ARCH"
11+
1012
TEST_MATRIX=()
1113
for PY in "${PYTHON_VERSIONS[@]}"; do
1214
for QT in "${QT_VERSIONS[@]}"; do
@@ -46,8 +48,3 @@ done
4648

4749
# run in parallel
4850
printf "%s\n" "${TEST_MATRIX[@]}" | xargs -n2 -P4 scripts/test-combo.sh
49-
50-
# combine coverage
51-
uv run --active coverage combine --quiet
52-
uv run --active coverage report --sort=cover --show-missing
53-
# uv run --active coverage report --sort=cover --show-missing xml coverage.xml

0 commit comments

Comments
 (0)