diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index de40c8a10e2..74fac592ed4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -277,11 +277,15 @@ jobs: - name: Test without coverage if: "! matrix.use_coverage" shell: bash + env: + _PYTEST_TOX_POSARGS_JUNIT: --junitxml=junit-${{ matrix.name }}.xml run: tox run -e ${{ matrix.tox_env }} --installpkg `find dist/*.tar.gz` - name: Test with coverage if: "matrix.use_coverage" shell: bash + env: + _PYTEST_TOX_POSARGS_JUNIT: --junitxml=junit-${{ matrix.name }}.xml run: tox run -e ${{ matrix.tox_env }}-coverage --installpkg `find dist/*.tar.gz` - name: Upload coverage to Codecov @@ -292,6 +296,14 @@ jobs: files: ./coverage.xml verbose: true + - name: Upload JUnit report to Codecov + uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 + with: + fail_ci_if_error: false + files: junit-${{ matrix.name }}.xml + report_type: test_results + verbose: true + check: # This job does nothing and is only used for the branch protection if: always() diff --git a/AUTHORS b/AUTHORS index a089ca678f7..6f292256ff1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -14,6 +14,7 @@ Ahn Ki-Wook Akhilesh Ramakrishnan Akiomi Kamakura Alan Velasco +Alejandro Villate Alessio Izzo Alex Jones Alex Lambson diff --git a/changelog/12689.contrib.rst b/changelog/12689.contrib.rst new file mode 100644 index 00000000000..78cacc0d828 --- /dev/null +++ b/changelog/12689.contrib.rst @@ -0,0 +1 @@ +automated uploading JUnit reports to codecov in the test workflow with codecov GitHub Action diff --git a/tox.ini b/tox.ini index 35f337cdc71..5a8fa240898 100644 --- a/tox.ini +++ b/tox.ini @@ -62,7 +62,7 @@ description = doctesting: including doctests commands = {env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:{env:_PYTEST_TOX_DEFAULT_POSARGS:}} - doctesting: {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest + doctesting: {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules {env:_PYTEST_TOX_POSARGS_JUNIT:} --pyargs _pytest coverage: coverage combine coverage: coverage report -m # Run `coverage xml` only on CI. @@ -73,7 +73,7 @@ passenv = TERM CI setenv = - _PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_DOCTESTING:} {env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_XDIST:} {env:_PYTEST_FILES:} + _PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_DOCTESTING:} {env:_PYTEST_TOX_POSARGS_JUNIT:} {env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_XDIST:} {env:_PYTEST_FILES:} # See https://docs.python.org/3/library/io.html#io-encoding-warning # If we don't enable this, neither can any of our downstream users!