From 701425102e2f377de95b691c4b5ddc94c1d232f2 Mon Sep 17 00:00:00 2001 From: Simon Torres Date: Fri, 26 Jul 2024 11:21:26 -0400 Subject: [PATCH] add coverage reporting --- .github/workflows/python-package.yml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e3370e5f..3f3704e7 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -76,10 +76,34 @@ jobs: - name: Run Tests run: | tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }} + - name: Upload coverage to artifacts + if: ${{ contains(matrix.toxenv,'-cov') }} + uses: actions/upload-artifacts@v4 + with: + name: coverage_${{ matrix.toxenv }}.xml + path: coverage.xml + if-no-files-found: error - - uses: codecov/codecov-action@v4 + upload-coverage-report: + needs: ['tests'] + permissions: + contents: none + runs-on: ubuntu-latest + name: Upload Coverage + steps: + - name: Download coverage artifacts + uses: actions/download-artifacts@v4 + with: + path: coverage + pattern: coverage_* + merge-multiple: true + - name: Upload to Codecov + if: ${{ hashFiles('coverage/') != ''}} + uses: codecov/codecov-action@v4 with: - token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos + token: ${{ secrets.CODECOV_TOKEN }} + directory: coverage fail_ci_if_error: true # optional (default = false) + verbose: true