8000 CI: Ensure code coverage is always uploaded · matplotlib/matplotlib@25847dd · GitHub
[go: up one dir, main page]

Skip to content

Commit 25847dd

Browse files
committed
CI: Ensure code coverage is always uploaded
If code coverage is not uploaded on failure, then overall coverage can suffer mysteriously (e.g., if a mac system failed, then it would appear as if `backend_macosx.py` was not tested). Codecov would then show several "indirect changes" that are spurious. On GitHub Actions, if you don't have any status check function in the `if` entry, then it is treated as `success() && (whatever else you had)`, so put in an explicit check. Azure also had no condition, so defaulted to only-on-success. Cygwin is only run on `main` and sometimes on PRs, so disable code coverage reporting from it. That would cause random "reductions" in coverage for all PRs that don't run it (which is most of them.) Also, fix the image-cleanup script, which would only run on success instead of failure, where it would be useful.
1 parent ce15014 commit 25847dd

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

.github/workflows/cygwin.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,4 @@ jobs:
245245
run: |
246246
xvfb-run pytest-3.${{ matrix.python-minor-version }} -rfEsXR -n auto \
247247
--maxfail=50 --timeout=300 --durations=25 \
248-
--cov-report=xml --cov=lib --log-level=DEBUG --color=yes
249-
250-
- name: Upload code coverage
251-
uses: codecov/codecov-action@v4
252-
with:
253-
token: ${{ secrets.CODECOV_TOKEN }}
248+
--cov-report=term --cov=lib --log-level=DEBUG --color=yes

.github/workflows/tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ jobs:
316316
--cov-report=xml --cov=lib --log-level=DEBUG --color=yes
317317
318318
- name: Cleanup non-failed image files
319+
if: failure()
319320
run: |
320321
function remove_files() {
321322
local extension=$1
@@ -349,6 +350,7 @@ jobs:
349350
fi
350351
351352
- name: Filter C coverage
353+
if: ${{ !cancelled() && github.event_name != 'schedule' }}
352354
run: |
353355
if [[ "${{ runner.os }}" != 'macOS' ]]; then
354356
lcov --rc lcov_branch_coverage=1 --capture --directory . \
@@ -364,7 +366,7 @@ jobs:
364366
-instr-profile default.profdata > info.lcov
365367
fi
366368
- name: Upload code coverage
367-
if: ${{ github.event_name != 'schedule' }}
369+
if: ${{ !cancelled() && github.event_name != 'schedule' }}
368370
uses: codecov/codecov-action@v4
369371
with:
370372
name: "${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.name-suffix }}"

azure-pipelines.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,13 @@ stages:
268268
;;
269269
esac
270270
displayName: 'Filter C coverage'
271+
condition: succeededOrFailed()
271272
- bash: |
272273
bash <(curl -s https://codecov.io/bash) \
273274
-n "$PYTHON_VERSION $AGENT_OS" \
274275
-f 'coverage.xml' -f 'extensions.xml'
275276
displayName: 'Upload to codecov.io'
277+
condition: succeededOrFailed()
276278
277279
- task: PublishTestResults@2
278280
inputs:

0 commit comments

Comments
 (0)
0