Is it possible to get coverage for a whole project not just files changed in an MR?

My company is turning on coverage reporting. We currently see the coverage % in our MRs and can see the lines covered in any code that changes. What we really want though is to get a holistic view of all the source code that is covered.

As far as I can tell the only way to get visualization of code that covered is to create an MR and change every file in your repo slightly and then click “Show whole file” on each file in an MR. This seems like a lot of work. What I’d really love is to be able to see the coverage as I click through the files in the Source view in the repo and be able to see the % of coverage in the file list views so I can drill into any file that has low coverage.

There are two ways I have found to do this, but both involve extra tooling.

Coverage HTML reports as artifacts

Use your coverage tool to generate an HTML report and list it as an artifact. You should then be able to click through from the CI job to the artifacts list and browse it directly without downloading and re-opening it from disk.

    COVERAGE_HTML_DIR: coverage_html
    - cd build
    # One run for Cobertura report (the coloured margin bars)
    - >
      --xml --output="$COVERAGE_COBERTURA_FILE"
      # Other grcov options...
    # Another run to generate HTML coverage report
    - >
      --html --output="$COVERAGE_HTML_DIR"
      # Other grcov options...
    # Extract and print percentage from Cobertura because Gitlab can't, see:
    - >
      xmllint --xpath
      "concat('gitlab-coverage ', 100 * string(//coverage/@line-rate), '%')"
  coverage: '/^gitlab-coverage .+%$/'
      junit: $PROJECT_NAME/result.xml
        coverage_format: cobertura

I have omitted a bunch of config keys and explanation of paths etc. to emphasise the general concept, and to show how it might relate to other coverage processing. Grcov is not essential for this, any coverage tool that generates HTML should work here.

3rd party coverage analysis

Use a 3rd party/external coverage analysis service like Codecov, where you upload your coverage to them and they have a nice UI for browsing and analysing it.