Skip to content

Commit

Permalink
Coverage: Upload as separate step
Browse files Browse the repository at this point in the history
so it can be restarted without re-running the whole test suite
because sometimes Codecov rate limits.
  • Loading branch information
pllim committed May 8, 2024
1 parent 2042027 commit 83924f5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/test_tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,17 @@ jobs:
test_venv:
uses: ./.github/workflows/tox.yml
with:
coverage: ''
envs: |
- linux: pep8
name: style_check
pytest: false
- linux: py312
coverage: codecov
- macos: py311
coverage: codecov
- windows: py310
coverage: codecov
test_conda:
uses: ./.github/workflows/tox.yml
Expand Down
28 changes: 27 additions & 1 deletion .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,35 @@ jobs:
with:
paths: "**/results.xml"

- name: Upload to Codecov
- name: Upload coverage to artifacts
# Even if tox fails, upload coverage
if: ${{ (success() || failure()) && contains(matrix.coverage, 'codecov') && matrix.pytest == 'true' }}
uses: actions/upload-artifact@v4
with:
name: coverage_${{ matrix.toxenv }}.xml
path: coverage.xml
if-no-files-found: error

upload-codecov:
needs: [tox]
permissions:
contents: none
runs-on: ubuntu-latest
name: Upload Coverage
steps:

- name: Download coverage artifacts
uses: actions/download-artifact@v4
with:
path: coverage
pattern: coverage_*
merge-multiple: true

- name: Upload report to Codecov
if: ${{ hashFiles('coverage/') != '' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: coverage
fail_ci_if_error: true
verbose: true

0 comments on commit 83924f5

Please sign in to comment.