From b6efef45a498a62adb8d6273be636ae643a3abac Mon Sep 17 00:00:00 2001 From: Fabrice Normandin Date: Tue, 14 May 2024 14:00:45 -0400 Subject: [PATCH] Upload coverage report as a single last step Signed-off-by: Fabrice Normandin --- .github/workflows/build.yml | 46 ++++++++++++++---------- .github/workflows/full_cluster_tests.yml | 21 +++++++++-- .github/workflows/testing.yml | 15 +++----- 3 files changed, 51 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 97b4ce2b..3559bb81 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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/codecov-action@v4.3.1 + - 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 @@ -151,15 +147,11 @@ jobs: env: SLURM_CLUSTER: localhost - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.3.1 + - 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: @@ -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 diff --git a/.github/workflows/full_cluster_tests.yml b/.github/workflows/full_cluster_tests.yml index 98748621..6d98bd45 100644 --- a/.github/workflows/full_cluster_tests.yml +++ b/.github/workflows/full_cluster_tests.yml @@ -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 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 176845ec..155d0b15 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -12,9 +12,6 @@ on: required: false type: number default: 30 - secrets: - CODECOV_TOKEN: - required: true workflow_dispatch: @@ -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