From d080321e999829371cd647baa0d384250c0bea5e Mon Sep 17 00:00:00 2001 From: "John R. D'Orazio" Date: Mon, 3 Aug 2026 14:57:04 +0200 Subject: [PATCH] Only upload test results to Codecov when pytest actually ran The test-results upload is guarded by `if: ${{ !cancelled() }}`, which is deliberate: when the suite runs and fails, that is precisely when Codecov's test analytics is worth having, so it must not be skipped on failure. But that condition cannot tell "tests ran and failed" from "tests never ran". When an earlier step fails -- pyright did, on PR #23 -- GitHub skips the pytest step, so no junit.xml is produced, while the upload step still executes and reports "The CLI was unable to find any JUnit XML files to upload." That reads like a broken Codecov configuration and draws attention away from the actual failure, which was three steps earlier. Giving pytest an id and adding `steps.pytest.conclusion != 'skipped'` keeps the valuable case and drops the noisy one. The coverage upload needed no change: it carries no `if`, so it already inherits the default success() condition and was correctly skipped in that run. Note this cannot be demonstrated by a green CI run, which exercises only the unchanged path. It was verified against run 30808584716, where the step list shows pytest skipped and the upload succeeding with nothing to upload. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0acea7..eac0bc3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,6 +31,7 @@ jobs: run: pyright - name: pytest + id: pytest run: pytest -q --cov --cov-branch --cov-report=term-missing --cov-report=xml --junitxml=junit.xml - name: Coverage summary @@ -46,8 +47,13 @@ jobs: slug: CatholicOS/martyrology-api files: coverage.xml + # Upload results when pytest RAN, pass or fail — a failing suite is + # exactly when Codecov's test analytics earns its keep. Skip when pytest + # never ran (an earlier step failed), since there is no junit.xml to find + # and the resulting "unable to find any JUnit XML files" notice reads like + # a config fault while distracting from the real failure. - name: Upload test results to Codecov - if: ${{ !cancelled() }} + if: ${{ !cancelled() && steps.pytest.conclusion != 'skipped' }} uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 with: token: ${{ secrets.CODECOV_TOKEN }}