If the coverage not shown on MR diffs:
- ensure the giltlab.yaml job
artifactfield config is correct. - on the job logs the
artifactis success upload. - the coverage report contents pointing the
filesto correct path (or relative path)
The gocover-cobertura output may contain absolute paths that the gitlab runner cannot match. So ensure the content of coverage reports using relative paths, by replace then using sed command.
For example, your module name in go.mod:
module my-app
go 1.23.2
Then you need to do sed command the test-coverage.xml file with:
$ sed -i "s=<source>.*</source>=<source>./</source>=g" test-coverage.xml
$ sed -i "s;filename=\"my-app/;filename=\";g" test-coverage.xml
The visualizer is shown on MR. Run the pipeline again and ensure it success. Open the Changes tab to show file diffs and see the coverage green marker next to the line number.
If still not shown, then download the test-coverage.xml artifact and check its contents to use correct relative path to root project.
Next, open the developer tools on your browser, open Network / XHR tab, then check the coverage_reports.json file contents. It should not be empty.
Good luck !