Simon Arsenault
Simon Arsenault

Reputation: 1845

Is there a way to show build status/code coverage per branch

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.

Upvotes: 15

Views: 5946

Answers (3)

VonC
VonC

Reputation: 1324278

Is there a way to show build status/code coverage per branch

One new feature which does relate to this is with GitLab 13.6 (November 2020):

Pipeline status in branch and tag lists

If you use CI/CD pipelines with tags or branches and want to know the latest pipeline status, you previously had to navigate away from the branch list or tag list to get to the pipeline page. Now, pipeline status icons are displayed for each branch or tag in their respective list views so you can quickly get to this information for many tags or branches in less clicks.

Thanks to Lee Tickett for this contribution!

https://about.gitlab.com/images/13_6/pipeline_status_tag_list.png -- Pipeline status in branch and tag lists

See Documentation and Issue.

Upvotes: 1

VonC
VonC

Reputation: 1324278

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.

https://about.gitlab.com/images/13_4/coverage-tooltip.png -- Show job data for Code Coverage value in MR

See Documentation and Issue.

Upvotes: 1

Drew Blessing
Drew Blessing

Reputation: 2705

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.

branch commit pipeline status

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.

Upvotes: 1

Related Questions