Skip to content

Commit

Permalink
Upload coverage report as a single last step
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrice Normandin <[email protected]>
  • Loading branch information
lebrice committed May 14, 2024
1 parent 22c2411 commit b6efef4
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 31 deletions.
46 changes: 28 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,11 @@ jobs:
- name: Test with pytest
run: poetry run pytest --cov=milatools --cov-report=xml --cov-append

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
- name: Store coverage report as an artifact
uses: actions/upload-artifact@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
env_vars: PLATFORM,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
name: coverage-reports
path: ./coverage.xml

mock-slurm-integration-tests:
name: integration tests with a mock slurm cluster
Expand Down Expand Up @@ -151,15 +147,11 @@ jobs:
env:
SLURM_CLUSTER: localhost

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
- name: Store coverage report as an artifact
uses: actions/upload-artifact@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: integrationtests
env_vars: PLATFORM,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
name: coverage-reports
path: ./coverage.xml

real-slurm-integration-tests:

Expand All @@ -178,5 +170,23 @@ jobs:
cluster: ${{ matrix.cluster }}
python-version: ${{ matrix.python-version }}
timeout-minutes: 30
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

# https://about.codecov.io/blog/uploading-code-coverage-in-a-separate-job-on-github-actions/
upload-coverage-codecov:
needs: [real-slurm-integration-tests]
runs-on: ubuntu-latest
name: Upload coverage reports to Codecov
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
# file: ./coverage.xml # Search for all coverage files from each workflow.
# flags: integrationtests
# env_vars: PLATFORM,PYTHON
# name: codecov-umbrella
fail_ci_if_error: true
21 changes: 19 additions & 2 deletions .github/workflows/full_cluster_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,22 @@ jobs:
cluster: ${{ matrix.cluster }}
python-version: ${{ matrix.python-version }}
timeout-minutes: 60
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# https://about.codecov.io/blog/uploading-code-coverage-in-a-separate-job-on-github-actions/
upload-coverage-codecov:
needs: [real-slurm-integration-tests]
runs-on: ubuntu-latest
name: Upload coverage reports to Codecov
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
# file: ./coverage.xml # Search for all coverage files from each workflow.
flags: integrationtests
# env_vars: PLATFORM,PYTHON
# name: codecov-umbrella
fail_ci_if_error: true
15 changes: 4 additions & 11 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ on:
required: false
type: number
default: 30
secrets:
CODECOV_TOKEN:
required: true

workflow_dispatch:

Expand Down Expand Up @@ -53,12 +50,8 @@ jobs:
env:
SLURM_CLUSTER: ${{ inputs.cluster }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
- name: Store coverage report as an artifact
uses: actions/upload-artifact@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: integrationtests
env_vars: PLATFORM,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
name: coverage-reports
path: ./coverage.xml

0 comments on commit b6efef4

Please sign in to comment.