Skip to content

Replace Codecov with ReportGenerator coverage gate - #470

Merged
craigktreasure merged 1 commit into
mainfrom
craig/remove-codecov
Aug 4, 2026
Merged

Replace Codecov with ReportGenerator coverage gate#470
craigktreasure merged 1 commit into
mainfrom
craig/remove-codecov

Conversation

@craigktreasure

Copy link
Copy Markdown
Owner

Summary

Codecov was sold to Harness. This replaces the upload with a fully in-repo approach using the ReportGenerator dotnet tool — no third-party GitHub Actions involved:

  • Coverage summary rendered into the workflow job summary (MarkdownSummaryGithub report type)
  • HTML report uploaded as a build artifact for line-by-line drill-down, named per matrix leg
  • Coverage gate: minimumCoverageThresholds fails the build when line or branch coverage falls below the floor
  • Tool is version-pinned in .config/dotnet-tools.json, restored by the existing install-tools action, and already covered by Dependabot's nuget updates
  • The dotnet-coverage global install and merge steps are gone — ReportGenerator reads all nine cobertura files directly
  • Removes codecov.yml and the README badge
  • Drops secrets: inherit from CI.yml and PR.yml, since CODECOV_TOKEN was the only secret the build workflow used

Thresholds

Both line and branch coverage are gated at 95%, matching the target the old codecov.yml used. Current coverage is 100% line and 98.8% branch.

Source-generated regex code is excluded via -classfilters. It appears three times (once per TFM) and accounts for the entire gap between the raw 89.9% line coverage and the 100% of hand-written code. Codecov never counted it either — those files live under __artifacts/obj and do not exist in the commit, which is what made a 95% target viable there.

Notes

  • Multiple thresholds must be passed as separate arguments. Combining them as lineCoverage=95;branchCoverage=95 throws a config-binder exception and still exits 0.
  • On a breach, ReportGenerator writes the reports before exiting non-zero, so the !cancelled() guards on the summary and artifact steps still publish.
  • The summary step uses pwsh rather than cat >> "$GITHUB_STEP_SUMMARY" so it works on the windows-2025 leg of the PR matrix.
  • .config/** is in CI.yml's paths-ignore, so Dependabot bumps of the tool will not trigger a CI build on main. They still run the full PR matrix, so the gate is exercised.

Codecov was sold to Harness. Replace the upload with an in-repo approach
using the ReportGenerator dotnet tool: a coverage summary in the workflow
job summary, an HTML report uploaded as a build artifact, and a threshold
check that fails the build when coverage regresses.

Source-generated regex code is excluded from the report. It accounts for
the entire gap between the raw 89.9% line coverage and the 100% of
hand-written code, and Codecov never counted it either since those files
do not exist in the commit.

Also drop `secrets: inherit` from the calling workflows, since
CODECOV_TOKEN was the only secret the build workflow used.
@craigktreasure
craigktreasure merged commit 3d479e6 into main Aug 4, 2026
3 checks passed
@craigktreasure
craigktreasure deleted the craig/remove-codecov branch August 4, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant