gitlabsimplecov

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?


Solution

  • You now (June 2020, GitLab 13.1) have code coverage history, in addition of Test coverage parsing.

    Graph code coverage changes over time for a project

    All too often, a project has a code coverage target but development teams might not have much visibility into which direction that target value is trending over time.
    There needs to be an easier way to track changes in code coverage over time without that extra hassle.

    The Code Coverage graph now provides better visibility into how code coverage is trending over time.
    It displays a simple graph of the coverage value(s) calculated in pipelines.

    https://about.gitlab.com/images/13_1/code-coverage-graph.png

    See Documentation and Issue


    Also (introducted in Gitlab 12.9 all tiers), can see code coverage in MR diff (ref).

    Doc https://docs.gitlab.com/ee/ci/testing/img/test_coverage_visualization_v12_9.png


    With GitLab 13.6 (November 2020), you also have (not for free though)

    Display code coverage data for selected projects

    In 13.4, we released the first iteration of Code Coverage data for Groups that enables you to compare the coverage of multiple projects and download the data in a single file from a single screen. However, to analyze the data, you had to open the file to check it manually, and probably imported it into a spreadsheet for further analysis. In GitLab 13.6, you can now select specific projects in a group to see their latest coverage values directly in GitLab itself without needing to download a file or waste development time accessing code coverage data. We welcome feedback on the functionality and possible iterations for this feature in our feedback issue.

    https://about.gitlab.com/images/13_6/display_selected_coverage_projects_example.png -- Display code coverage data for selected projects

    See Documentation and Issue.