Enforce Code Coverage for merge
### Problem When someone is submitting MRs to the project I maintain, I only want to allow merge if the test coverage value stays the same/increases/is at a certain percentage, so that I can reduce the likelihood of bugs I have to fix later. ### Proposal 1. Create a mechanism in .gitlab-ci.yml to disallow an MR from being merged if the test coverage deceases - https://gitlab.com/gitlab-org/gitlab/-/issues/15765 1. Add a mechanism to disallow an MR from being merged if the test coverage decreases to UI - TBD 1. Create a mechanism in .gitlab-ci.yml to enforce a specific test coverage percentage by job - https://gitlab.com/gitlab-org/gitlab/-/issues/6284 1. Add a mechanism to enforce a specific test coverage by job in the UI - TBD 1. STRETCH? - Add a ~"GitLab Premium" version that utilizes [Required Approvers](https://docs.gitlab.com/ee/user/project/merge_requests/merge_request_approvals.html#required-approvals) ### Documentation It looks like overall, there will be: * Something in the pipeline configuration, so what constitutes pass/fail can be customized per job. There would be doco at least here: https://docs.gitlab.com/ee/ci/yaml/README.html. * Something in the UI to enable this on the MR side. It might affect: * Approval, a bit like our settings for "prevent approval..." , so that any MR that runs a job like this can be made non-approvable on fail. If it's like the other approval settings, there might be documentation at least at: https://docs.gitlab.com/ee/user/project/merge_requests/merge_request_approvals.html. * Mergeability, a bit like "Pipelines must succeed" or "All discussions must be resolved" settings. Documentation might be at least at: https://docs.gitlab.com/ee/ci/merge_request_pipelines/index.html. ### Not included in this version 1. Create and enforce coverage % by file 1. Data view of projects/files/groups not meeting required coverage thresholds 1. Data view of projects with overridden MRs not meeting coverage
epic