Use undercover to enforce changes in MR has coverage
What does this MR do and why?
Related issue: #345962 (closed)
Use the undercover
gem to enforce changes in MR has coverage. This will fail the pipeline if changes introduced in this MR has zero coverage
How this works :
- We generate coverage data as usual
- We gather coverage data from all RSpec jobs as usual
- We use undercover gem to calculate the MR diff, and fail the job if any lines in the diff has zero coverage (see https://gitlab.com/gitlab-org/gitlab/-/jobs/1804857414 for example)
- Run with minimal RSpec
- Also run when pipeline:run-all-rspec is present on MR
- Allowed to fail when pipeline:skip-undercoverage is present on MR
Tasks:
-
Review https://rubygems.org/gems/undercover itself (security, license, etc) -
Rugged version problem - Resolve https://github.com/grodowski/undercover/issues/160, or fork it temporarily -
Do we run undercover
for minimal runs ? Yes, but with label to allow failure -
Roll out to all MRs -
Test that no coverage makes it fail https://gitlab.com/gitlab-org/gitlab/-/jobs/1831993926 -
Test label with no coverage allows failure https://gitlab.com/gitlab-org/gitlab/-/jobs/1832210870
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
Failing rspec:coverage
job
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Thong Kuah