Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to add coverage report to gitlab?

I understand that gitlab has support to Jenkins CI, but what I need is a lot less than that.

I have a Rails application and get the coverage from the tests using simplecov. It generates HTML output in a directory by running a rake task. I would like to see the current coverage through gitlab. Is there a simple way to integrate this report with gitlab?

like image 353
fotanus Avatar asked Jul 23 '13 13:07

fotanus


People also ask

How do I display code coverage?

On the Test menu, select Analyze Code Coverage for All Tests. You can also run code coverage from the Test Explorer tool window. Show Code Coverage Coloring in the Code Coverage Results window. By default, code that is covered by tests is highlighted in light blue.


3 Answers

I fear there is still no easy way to integrate code coverage reports but Gitlab now supports (since Version 8.0 integrated) build jobs for your code. Unfortunately you have to implement your solution by writing a custom .gitlab-ci.yml to run your coverage tests. For viewing the reports, you can specify the generated "artifacts" or publish them on gitlab pages.

For more information, see here: https://about.gitlab.com/gitlab-ci/

Additionally you can parse a text output to display a short code coverage report:

  • (Enable builds and output test coverage)
  • Go to "Project Settings" -> Builds
  • Add to "Test coverage parsing" a regular expression (examples below, simplecov included)
like image 178
Trendfischer Avatar answered Oct 13 '22 13:10

Trendfischer


See Publish Code Coverage Report with GitLab Pages

like image 7
Ian Vaughan Avatar answered Oct 13 '22 12:10

Ian Vaughan


The short answer: Unfortunately there is no easy way to do this.

The longer answer: GitLab not yet has a Jenkins support.

What you basically need is a service like GitLab CI or Jenkins CI, which starts simplecov and posts the output back to GitLab. Unfortunately GitLab does not offer such a functionality yet.

But I know other organizations which do have a Jenkins service for GitLab which automatically comment git pushes with the Jenkins result.

like image 3
Razer Avatar answered Oct 13 '22 13:10

Razer