We are setting the CI on our GitLab and we are able to show build status and code coverage on master using the following:
README.md
in root directory of myproject
:
[![build status](http://mygitlab/mygroup/myproject/badges/master/build.svg)](http://mygitlab/mygroup/myproject/commits/master)
[![coverage report](http://mygitlab/mygroup/myproject/badges/master/coverage.svg)](http://mygitlab/mygroup/myproject/commits/master)
Something we would like is show build status/code coverage of current branch when viewing the README.md
in the branch. Right now, the links have master
hardcoded so the branches show the status of the master.
Is there a way to use relative URL (or something else) so the build status / code coverage automatically adapt to the branch you're viewing? Looking at the documentation, it looks like it's impossible, because you have to specify the branch.
Branch coverage is a testing method, which aims to ensure that each one of the possible branch from each decision point is executed at least once and thereby ensuring that all reachable code is executed.
What I would really like to see is what the Code coverage was Before and After a merge request, while reviewing merge requests
Actually, this is easier with GitLab 13.4 (September 2020)
Show job data for Code Coverage value in MR
As a developer, you should be able to easily see code coverage after a pipeline finishes running, even in complex scenarios that make this more difficult, like when your pipeline has multiple jobs that are parsed to calculate the coverage value.
Until now, the Merge Request widget only showed the average of those values, which meant you had to navigate to the jobs page and then back to the Merge Request itself to get more granular details for the coverage value.
To save you time and eliminate those extra steps, you’re now presented with the average coverage value, how it has changed from the target and source branch, and a tooltip that shows the coverage for each job used to calculate the average.
See Documentation and Issue.
Starting in GitLab 9.3 (available only in Starter/Bronze and higher), code quality will be evaluated as part of the CI/CD pipeline and the results will display in the merge request.
You can see an example of how this looks in a merge request in the documentation at GitLab Code Quality.
This works 'automatically' via Auto DevOps or you can configure Code Quality manually by using the Code Quality examples
This doesn't address showing code quality and pipeline status for a given branch in the README. As mentioned, it does show the pipeline status and code quality in the MR itself. However, when viewing a particular branch, the commit at the top of the page does show the overall pipeline status. Click on that status to go to the pipeline for more detailed job information, including the Code Quality job itself.
It's not quite as handy as what you're looking for, but it is a workaround. Usually, concerns about quality and build status are most important on the proposed merge request itself, where fixes can be made prior to merging them into the master/target branch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With