4/edit ci pipeline to account for 100 code coverage #7
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
This PR introduces a new check to the CI pipeline to enforce 100% code coverage on all new pull requests.
Changes
I've modified the ci-build.yaml file to include a new step that fails the build if the total code coverage percentage is anything less than 100%.
Key updates in the workflow
Test with Coverage: The go test command now uses the -coverprofile=coverage.out flag to generate a coverage report. It also dynamically excludes specific files and directories from the coverage calculation based on a list in tests/config.yaml.
Check 100% coverage: A new step was added to parse the coverage.out file. It extracts the total coverage percentage and uses a shell script to enforce that the value is exactly 100.0. If it's not, the build will fail.
Upload coverage report: The workflow now uploads the coverage.out file to Codecov for detailed analysis.