Skip to content

Commit b3f1d77

Browse files
authored
Merge pull request #24 from ARRC-Rocket/ci/coverage-that-cannot-report-a-green-it-did-not-earn
Coverage that cannot report a green it did not earn
2 parents 6ec4a2c + c15632a commit b3f1d77

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

.github/workflows/test_pytest.yaml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,41 @@ jobs:
6161
run: pytest tests/integration --cov=rocketpy --cov-append
6262

6363
- name: Run Acceptance Tests
64-
run: pytest tests/acceptance --cov=rocketpy --cov-append --cov-report=xml
64+
run: pytest tests/acceptance --cov=rocketpy --cov-append --cov-report=xml:coverage-${{ matrix.os }}-${{ matrix.python-version }}.xml
6565

6666
- name: Upload coverage to artifacts
6767
uses: actions/upload-artifact@main
6868
with:
69-
name: coverage
70-
path: coverage.xml
71-
overwrite: true
69+
# One name per leg. Six legs sharing a name with overwrite deleted each
70+
# other's artifact rather than merging, so five reports were discarded
71+
# and the surviving one was whichever leg happened to finish last.
72+
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
73+
path: coverage-${{ matrix.os }}-${{ matrix.python-version }}.xml
7274
if-no-files-found: error
7375

7476
CodecovUpload:
7577
needs: Pytest
7678
runs-on: ubuntu-latest
7779
steps:
7880
- uses: actions/checkout@main
79-
- name: Download latest coverage report
81+
- name: Download every coverage report
8082
uses: actions/download-artifact@main
83+
with:
84+
pattern: coverage-*
85+
merge-multiple: true
86+
path: coverage-reports
87+
- name: Refuse to upload nothing
88+
# `ls` exits non-zero on no match. Without this the upload has nothing to
89+
# send and still reports success, which is the failure being fixed here.
90+
run: ls coverage-reports/*.xml
8191
- name: Upload to Codecov
8292
uses: codecov/codecov-action@main
8393
with:
8494
token: ${{ secrets.CODECOV_TOKEN }}
85-
files: |
86-
coverage.xml
95+
# A directory rather than a filename: there is one report per matrix
96+
# leg now. The previous block literal passed "coverage.xml\n", which was
97+
# not found, and only the fallback search made the upload work at all.
98+
directory: coverage-reports
99+
# Only fail when a token was there to use. Pull requests from forks get
100+
# no secrets, and a contributor should not see red for that.
101+
fail_ci_if_error: ${{ secrets.CODECOV_TOKEN != '' }}

0 commit comments

Comments
 (0)