ci(coverage): enforce 90% minimum line coverage on pull requests#348
Merged
Conversation
Add a coverage threshold enforcement step to the Validate workflow. PRs that drop total line coverage below 90% now fail the Validate Code gate and cannot be merged. Changes: - Add "Enforce coverage threshold" step after coverage report generation - Wire coverage job into the status gate job - Show threshold status (met / not met) in the PR coverage comment - Update ARCH-005 to document the 90% enforced target (was 80% guideline) Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Deploying archgate-cli with
|
| Latest commit: |
0635999
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://590ecc59.archgate-cli.pages.dev |
| Branch Preview URL: | https://ci-enforce-coverage-threshol.archgate-cli.pages.dev |
Contributor
Code Coverage
Full HTML report available in workflow artifacts. Per-directory breakdown
|
Extract two reusable composite actions to improve workflow readability: - .github/actions/setup-bun-project: Encapsulates moonrepo/setup-toolchain (SHA-pinned) + bun install. Used by validate, smoke-test-windows, and smoke-test-linux workflows. - .github/actions/coverage-report: Encapsulates the ~100-line inline bash script for coverage merging, HTML report generation, threshold computation, job summary, and PR comment posting. Reduces the coverage job from ~50 workflow lines to ~25 clearly named steps. Third-party actions inside composite actions remain SHA-pinned for security consistency, even though CI-001 only scans workflow files. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
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
Coverage Reportjob. PRs that drop below 90% fail theValidate Codegate and cannot be merged..github/actions/setup-bun-project— moonrepo/setup-toolchain +bun install, used by 3 workflows.github/actions/coverage-report— coverage merging, HTML report, threshold computation, PR comment posting (~100 lines of inline bash → 1 step)met/**not met**) in the PR coverage comment so authors see the result before the gate blocks.How it works
coverage-reportcomposite action merges Linux + Windows coverage traces, generates an HTML report, computes stats, and posts a sticky PR comment — all behind a singleuses:stepcoverage(percentage) andthreshold-met(boolean) for the callerEnforce coverage thresholdstep in the workflow reads the output and fails with::error::if coverage < 90%statusgate job (branch protection's single required check) includescoveragein itsneeds— so a threshold failure blocks the PRTest plan
90% minimum — metValidate Codestatus check depends on theCoverage Reportjob completing successfullysetup-bun-projectcomposite action