Skip to content

Commit fba02a5

Browse files
author
hildebrind
committed
add option to generate test coverage report without codecov
1 parent c4b5480 commit fba02a5

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

.github/workflows/tox.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,31 @@ jobs:
229229
uses: codecov/codecov-action@v4
230230
with:
231231
token: ${{ secrets.CODECOV_TOKEN }}
232+
233+
- name: Upload coverage data
234+
if: ${{ (success() || failure()) && contains(matrix.coverage, 'github') && matrix.pytest == 'true' }}
235+
uses: actions/upload-artifact@v4
236+
with:
237+
name: coverage-data-${{ matrix.os }}-${{ matrix.toxenv }}
238+
path: coverage.xml
239+
if-no-files-found: ignore
240+
241+
coverage:
242+
name: test coverage
243+
needs:
244+
- tox
245+
if: inputs.coverage == 'github'
246+
runs-on: ubuntu-latest
247+
steps:
248+
- uses: actions/checkout@v4
249+
- uses: actions/download-artifact@v4
250+
with:
251+
pattern: coverage-data-*
252+
merge-multiple: true
253+
- uses: actions/setup-python@v5
254+
with:
255+
python-version: "3.12"
256+
- run: python -Im pip install --upgrade coverage[toml]
257+
- run: python -Im coverage combine
258+
- run: python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
259+

docs/source/tox.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ This option has no effect if ``pytest`` is ``false``.
159159
coverage
160160
^^^^^^^^
161161

162-
A space separated list of coverage providers to upload to. Currently
163-
only ``codecov`` is supported. Default is to not upload coverage
162+
A space separated list of coverage providers to upload to, either
163+
``codecov`` or ``github``. Default is to not upload coverage
164164
reports.
165165

166166
See also, ``CODECOV_TOKEN`` secret.

0 commit comments

Comments
 (0)