Skip to content

Commit b4670f5

Browse files
committed
Add upload junit to codecov from CI
1 parent b1f365f commit b4670f5

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
@@ -276,11 +276,15 @@ jobs:
276276
- name: Test without coverage
277277
if: "! matrix.use_coverage"
278278
shell: bash
279+
env:
280+
JUNIT_XML_PATH: junit-${{ matrix.name }}.xml
279281
run: tox run -e ${{ matrix.tox_env }} --installpkg `find dist/*.tar.gz`
280282

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

286290
- name: Generate coverage report
@@ -295,6 +299,13 @@ jobs:
295299
files: ./coverage.xml
296300
verbose: true
297301

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

tox.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ description =
4242
under `{basepython}`
4343
doctesting: including doctests
4444
commands =
45-
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:{env:_PYTEST_TOX_DEFAULT_POSARGS:}}
46-
doctesting: {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest
45+
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:{env:_PYTEST_TOX_DEFAULT_POSARGS:}} --junitxml={env:JUNIT_XML_PATH}
46+
doctesting: {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest --junitxml={env:JUNIT_XML_PATH}
4747
coverage: coverage combine
4848
coverage: coverage report -m
4949
passenv =
@@ -52,6 +52,7 @@ passenv =
5252
TERM
5353
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST
5454
CI
55+
JUNIT_XML_PATH
5556
setenv =
5657
_PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_DOCTESTING:} {env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_XDIST:} {env:_PYTEST_FILES:}
5758

0 commit comments

Comments
 (0)