ci: gate PR merges on per-package coverage regression - #1247
Open
Surabhi-1605 wants to merge 1 commit into
Open
Conversation
Add a coverage regression gate that ensures no PR can lower the average
test coverage of any package below its current baseline on main.
Changes:
- reusable-coverage-report.yml: upload pkg-summary artifact for the
regression gate to consume; on merges to main, commit pkg-summary.txt
as .github/coverage-baseline.txt (the authoritative per-package baseline).
Also fix coverage-gate if: expression (remove erroneous ${{ }} wrapper).
- consul-dataplane-checks.yaml: add coverage-regression-gate job that
downloads the pkg-summary artifact, checks each package's average
against the baseline, and fails if any package regresses.
On the first PR after this merges the gate skips gracefully (no baseline
yet); the baseline is created on the next push to main.
Make coverage-regression-gate a required branch-protection check to
enforce on merge.
Go Test Coverage: 66.7%Patch coverage: N/A (no coverable Go lines changed) See the workflow run for the full per-package breakdown and downloadable HTML report. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1247 +/- ##
=======================================
Coverage 68.48% 68.48%
=======================================
Files 19 19
Lines 2186 2186
=======================================
Hits 1497 1497
Misses 587 587
Partials 102 102 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
Adds a per-package coverage regression gate to consul-dataplane, ensuring no PR can lower the average test coverage of any package below its current baseline on
main.This complements the existing 90% patch coverage gate (merged in #1178) — patch coverage asks "are your new lines tested?", this gate asks "did the overall package health go down?"
How it works
main,reusable-coverage-report.ymlcommits the per-package coverage averages to.github/coverage-baseline.txt(the authoritative baseline).coverage-regression-gatejob downloads the per-package summary artifact, compares each package against the baseline, and fails if any package average dropped.main.Changes
reusable-coverage-report.yml:pkg-summaryartifact so the regression gate job can consume itmain, commitpkg-summary.txtas.github/coverage-baseline.txtcoverage-gateif:expression (remove erroneous${{ }}wrapper on job-level condition)consul-dataplane-checks.yaml:coverage-regression-gatejob that enforces per-package coverage does not regressNotes
github.com/hashicorp/consul-dataplane) — no multi-module complexity/mocks/,/mock_) consistent with existing coverage filteringcoverage-regression-gatea required branch-protection check to enforce on merge