Skip to content

Commit

Permalink
Fix Codecov (#2742)
Browse files Browse the repository at this point in the history
* Add job to combine reports and remove codecov job

* Fix coverage report type
  • Loading branch information
atharva-2001 authored Jul 25, 2024
1 parent 2766edd commit 026cf03
Showing 1 changed file with 43 additions and 20 deletions.
63 changes: 43 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ on:

env:
CACHE_NUMBER: 0 # increase to reset cache manually
PYTEST_FLAGS: --tardis-refdata=${{ github.workspace }}/tardis-refdata --tardis-regression-data=${{ github.workspace }}/tardis-regression-data
PYTEST_FLAGS: --tardis-refdata=${{ github.workspace }}/tardis-refdata --tardis-regression-data=${{ github.workspace }}/tardis-regression-data --cov=tardis --cov-report=xml --cov-report=html --cov-append
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

defaults:
Expand All @@ -39,25 +39,6 @@ concurrency:


jobs:
codecov:
if: github.repository_owner == 'tardis-sn'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup_env
with:
os-label: linux-64
- name: Generate coverage report
run: |
pytest --cov=tardis --cov-report=xml --cov-report=html
- uses: codecov/codecov-action@v4
if: always()
with:
fail_ci_if_error: true
token: ${{ env.CODECOV_TOKEN }}
verbose: true

tests:
name: ${{ matrix.continuum }} continuum ${{ matrix.rpacket_tracking }} rpacket_tracking ${{ matrix.os }} ${{ inputs.pip_git && 'pip tests enabled' || '' }}
if: github.repository_owner == 'tardis-sn'
Expand Down Expand Up @@ -106,3 +87,45 @@ jobs:
- name: Refdata Generation tests
run: pytest tardis ${{ env.PYTEST_FLAGS }} --generate-reference -m "${{ matrix.continuum }} continuum and ${{ matrix.rpacket_tracking }} rpacket_tracking"
if: contains(github.event.pull_request.labels.*.name, 'run-generation-tests') || github.ref == 'refs/heads/master'

- run: mv .coverage .coverage.${{ strategy.job-index }}

- uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.continuum }}-continuum-${{ matrix.rpacket_tracking }}-rpacket_tracking-${{ matrix.os }}
path: |
.coverage*
!.coveragerc
combine_coverage_reports:
needs: [tests]
if: github.repository_owner == 'tardis-sn'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup_env
with:
os-label: linux-64

# will download all artifacts(in this case all are coverage reports)
- uses: actions/download-artifact@v4
with:
path: .
merge-multiple: true

- name: Combine coverage reports
run: |
coverage combine
coverage xml
coverage html
- name: Print report
run: coverage report

- uses: codecov/codecov-action@v4
if: always()
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

0 comments on commit 026cf03

Please sign in to comment.