fix(coverage): fail loud when an expected coverage artifact download fails#34
Merged
Merged
Conversation
…act is missing The coverage-output job in csharp-ci.yaml and scala-ci.yaml downloaded the coverage-percent artifact with continue-on-error: true and defaulted to an empty coverage output when the file was absent, conflating 'no coverage shard configured' (empty is correct) with 'coverage shard uploaded but the download failed' (blank/stale badge on a green run). The job now derives COVERAGE_EXPECTED from the normalized matrix: when a shard set coverage: true the download runs without continue-on-error and the read step rejects an empty value; when none did, the download step is skipped and the empty output stays intentional. Closes #25
Signed-off-by: monsieurleberre <monsieurleberre@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #25.
Problem
In
csharp-ci.yamlandscala-ci.yaml, thecoverage-outputjob downloaded the coverage artifact withcontinue-on-error: trueand defaulted to empty coverage when the file was absent. That conflated two distinct cases:if-no-files-found: error) but the download failed (throttling, retention, infra) → empty silently produced a blank/stale coverage badge on an otherwise-green run. ❌Fix (symmetric across both workflows,
coverage-outputjob only)needs: build-and-test→needs: [normalize, build-and-test]so the job can read the normalized matrix.env: COVERAGE_EXPECTED: ${{ contains(fromJSON(needs.normalize.outputs.matrix).*.coverage, true) }}.normalize-ci-matrix.shguarantees every shard entry carries a booleancoveragekey, so this cleanly answers "was a coverage shard configured" with zero changes to upstream jobs.continue-on-error: true; now gatedif: env.COVERAGE_EXPECTED == 'true'. Expected-but-failed downloads now fail the job loud; when no shard requested coverage the download is skipped entirely.COVERAGE_EXPECTED=trueand the read value is empty, emit::error::and exit 1 instead of outputting empty coverage.Verification
actionlintclean on both files; committed tree verified viagit show HEAD:<file>.normalizejob /normalize-ci-matrix.sh, confirmed thefromJSON(...).*object-filter is valid in job-levelenv, and confirmed the only consumer ofcoverage-output.outputs.coverageis the top-level workflow output (no internalneeds: coverage-output), so the newly-possible failure skips nothing internal.Behavior change
Fail-louder only: a run where the artifact silently vanished previously went green with a blank badge and will now fail
coverage-output. Healthy consumers see no change; zero-coverage-shard consumers keep the intentional empty output.