Skip to content

Commit ce2cffe

Browse files
committed
Fixup PR gh-207
1 parent fb26195 commit ce2cffe

File tree

4 files changed

+35
-11
lines changed

4 files changed

+35
-11
lines changed

.github/workflows/test_tox.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,15 @@ jobs:
158158
a/
159159
cache-key: cache-${{ github.run_id }}
160160
161+
test_coverage_github:
162+
uses: ./.github/workflows/tox.yml
163+
with:
164+
pytest: true
165+
coverage: github
166+
envs: |
167+
- linux: py313-covcheck
168+
- linux: py314-covcheck
169+
161170
test_artifact_upload:
162171
uses: ./.github/workflows/tox.yml
163172
with:

.github/workflows/tox.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,43 +219,46 @@ jobs:
219219

220220
- run: python -m tox -e ${{ matrix.toxenv }} ${{ matrix.toxargs }} -- ${{ matrix.pytest_flag }} ${{ matrix.posargs }}
221221

222-
- if: ${{ (success() || failure()) && matrix.artifact-path != '' }}
222+
- if: ${{ !cancelled() && matrix.artifact-path != '' }}
223223
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
224224
with:
225225
name: ${{ matrix.artifact-name }}
226226
path: ${{ matrix.artifact-path }}
227227

228-
- if: ${{ (success() || failure()) && matrix.pytest-results-summary == 'true' && matrix.pytest == 'true' }}
228+
- if: ${{ !cancelled() && matrix.pytest-results-summary == 'true' && matrix.pytest == 'true' }}
229229
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4
230230
with:
231231
paths: "**/results.xml"
232232

233233
- name: Upload to Codecov
234234
# Even if tox fails, upload coverage
235-
if: ${{ (success() || failure()) && contains(matrix.coverage, 'codecov') && matrix.pytest == 'true' }}
235+
if: ${{ !cancelled() && contains(matrix.coverage, 'codecov') && matrix.pytest == 'true' }}
236236
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
237237
with:
238238
token: ${{ secrets.CODECOV_TOKEN }}
239239

240240
- name: Upload coverage data to GitHub
241-
if: ${{ (success() || failure()) && contains(matrix.coverage, 'github') && matrix.pytest == 'true' }}
242-
uses: actions/upload-artifact@v4
241+
if: ${{ !cancelled() && contains(matrix.coverage, 'github') && matrix.pytest == 'true' }}
242+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
243243
with:
244244
name: .coverage.${{ github.sha }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.toxenv }}
245-
path: "${{ github.workspace }}/**/.coverage"
245+
path: "${{ github.workspace }}/**/.coverage*"
246+
if-no-files-found: error
247+
include-hidden-files: true
248+
246249

247250
report_overall_test_coverage:
248251
needs: [ tox ]
249252
if: always()
250253
name: report overall test coverage
251254
runs-on: ubuntu-latest
252255
steps:
253-
- uses: actions/checkout@v4
256+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
254257
with:
255258
lfs: true
256259
submodules: ${{ inputs.submodules }}
257260
ref: ${{ inputs.checkout_ref }}
258-
- uses: actions/download-artifact@v4
261+
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
259262
with:
260263
pattern: .coverage.*
261264
merge-multiple: true
@@ -264,17 +267,20 @@ jobs:
264267
[ "$(ls -A .coverage*)" ] && exit 0 || exit 1
265268
continue-on-error: true
266269
- if: steps.check_downloaded_files.outcome == 'success'
267-
uses: actions/setup-python@v5
270+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
268271
with:
269272
python-version: "3.12"
270273
- if: steps.check_downloaded_files.outcome == 'success'
271274
name: generate coverage report
272275
run: |
273-
python -Im pip install --upgrade coverage[toml]
276+
python -Im pip install 'pip>=25.1'
277+
python -Im pip install --group covcheck
274278
python -Im coverage combine
275279
python -Im coverage report -i -m --format=markdown >> $GITHUB_STEP_SUMMARY
276280
- if: steps.check_downloaded_files.outcome == 'success'
277-
uses: actions/upload-artifact@v4
281+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
278282
with:
279283
name: .coverage
280284
path: .coverage
285+
if-no-files-found: error
286+
include-hidden-files: true

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ concurrency = [
2626
"pytest-repeat>=0.9.3",
2727
"pytest-run-parallel>=0.4.4",
2828
]
29+
covcheck = [
30+
"coverage[toml] ; python_version < '3.11'",
31+
"coverage>=7.11.3",
32+
]
2933
test = [
3034
"hypothesis>=6.113.0",
3135
"pytest>=8.3.5",

tox.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ envlist =
77
py{,py}3{10,13}-python_version
88
libraries
99
cache-{setup,verify}
10+
covcheck
1011

1112
[testenv]
1213
allowlist_externals =
@@ -17,6 +18,9 @@ allowlist_externals =
1718
bash
1819
rolldice
1920
which
21+
dependency_groups =
22+
covcheck: covcheck
23+
covcheck: test
2024
skip_install = true
2125
passenv = MY_VAR
2226
commands =
@@ -48,6 +52,7 @@ commands =
4852
artifact-upload: bash -c "echo 'hello world' > test.txt"
4953
# Verify that freethreaded builds are using freethreaded interpreter
5054
py313t: python -c "import sys; assert 'free-threading' in sys.version"
55+
covcheck: coverage run --parallel-mode -m pytest --pyargs test_package {posargs}
5156

5257
[testenv:pep8]
5358
description = verify pep8

0 commit comments

Comments
 (0)