Fix code coverage information in MR diffs
Context
I noticed while working on gitlab-org/quality/engineering-productivity/team#427 that https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html is not currently working in MRs, even though we have it configured.
Problem
From https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html#limits:
A single Cobertura XML file can be no more than 10 MiB. For large projects, split the Cobertura XML into smaller files.
And our coverage report file is 20MB.
How to see the coverage report file?
I made an MR to export the artifact report file as an artifact for the rspec:coverage
job.
Goal
- Split the coverage file into many smaller files (see this discussion for an example on how to do this)
- Ensure that code coverage is added to MR diffs when running full pipelines
Technical hints
- We could split the file (in Ruby) right before finishing the job. It might be too long to add on the critical path though.
- We could also try to generate those files in the jobs directly, with the trade-off mentioned in https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html#limits:
When submitting many files, it can take a few minutes for coverage to show on a merge request.
I would be okay with that to start with, and if it makes the feature less useful, it'll still be time in a second iteration to merge some files together.