Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Fix coverage reporting in Gitlab CI #248

Open
floric opened this issue Jan 3, 2024 · 0 comments
Open

Fix coverage reporting in Gitlab CI #248

floric opened this issue Jan 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@floric
Copy link

floric commented Jan 3, 2024

What happened?

In Gitlab CI coverage reports can be shown in merge requests. But this needs valid cobertura files. Unfortunately this project uses an outdated library with some issues including the wrong value for filenames. That's why the report is not shown in Gitlab.

How can we reproduce it?

Create coverage xml file and provide as cobertura artifact in Gitlab job. The resulting MR won't have any hit/miss markes (green/red lines).

What environment did it happen in?

Gitlab 16.2, newest version of this project

Possible Solution

Simply use fork https://github.com/boumenot/gocover-cobertura with correct filename attribute.

I could provide an MR but unfortunately it seems like this repo is not maintained properly right now. :(

As a workaround we can use the following in Gitlab for alpine based images:

sed -i.bak 's@'"$CI_SERVER_HOST/$CI_PROJECT_PATH/"'@@g' coverage.xml

@floric floric added the bug Something isn't working label Jan 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant