Skip to content

Commit 59a49f5

Browse files
committed
Add upload junit to codecov from CI
1 parent ac8efe1 commit 59a49f5

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.github/workflows/test.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,15 @@ jobs:
277277
- name: Test without coverage
278278
if: "! matrix.use_coverage"
279279
shell: bash
280+
env:
281+
JUNIT_XML_PATH: junit-${{ matrix.name }}.xml
280282
run: tox run -e ${{ matrix.tox_env }} --installpkg `find dist/*.tar.gz`
281283

282284
- name: Test with coverage
283285
if: "matrix.use_coverage"
284286
shell: bash
287+
env:
288+
JUNIT_XML_PATH: junit-${{ matrix.name }}.xml
285289
run: tox run -e ${{ matrix.tox_env }}-coverage --installpkg `find dist/*.tar.gz`
286290

287291
- name: Upload coverage to Codecov
@@ -292,6 +296,13 @@ jobs:
292296
files: ./coverage.xml
293297
verbose: true
294298

299+
- name: Upload JUnit report to Codecov
300+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7
301+
with:
302+
fail_ci_if_error: false
303+
files: junit-${{ matrix.name }}.xml
304+
verbose: true
305+
295306
check: # This job does nothing and is only used for the branch protection
296307
if: always()
297308

tox.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ description =
6161
under `{basepython}`
6262
doctesting: including doctests
6363
commands =
64-
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:{env:_PYTEST_TOX_DEFAULT_POSARGS:}}
65-
doctesting: {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest
64+
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:{env:_PYTEST_TOX_DEFAULT_POSARGS:}} --junitxml={env:JUNIT_XML_PATH}
65+
doctesting: {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest --junitxml={env:JUNIT_XML_PATH}
6666
coverage: coverage combine
6767
coverage: coverage report -m
6868
# Run `coverage xml` only on CI.
@@ -72,6 +72,7 @@ passenv =
7272
PYTEST_ADDOPTS
7373
TERM
7474
CI
75+
JUNIT_XML_PATH
7576
setenv =
7677
_PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_DOCTESTING:} {env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_XDIST:} {env:_PYTEST_FILES:}
7778

0 commit comments

Comments
 (0)