So I have a netstandard library with a test project, nothing too large. This gets built and tested by Gitlab CI via dotnet test and coverlet. Part of the test's output will be this coverage report:
+---------+--------+--------+--------+
| | Line | Branch | Method |
+---------+--------+--------+--------+
| Total | 90.87% | 67.66% | 94.32% |
+---------+--------+--------+--------+
| Average | 90.87% | 67.66% | 94.32% |
+---------+--------+--------+--------+
Now Gitlab uses regex to parse that, so naturally I have this regex parsing the first value:
Total\s*\|\s*(\d+\.\d+)%
I put it in in the coverage parsing setting under settings > general pipelines, and also added coverage: /Total\s*\|\s*(\d+\.\d+)%/ to the job in the .gitlab-ci.yml. I validated the regex using rubular, as Gitlab suggested: https://rubular.com/r/LOazRNRFmChzIr and it confirms my regex will find that coverage amount.
And yet, there is no coverage to be seen anywhere. The badge I added to the project also shows "coverage: unknown".
Is something still missing?
Alright time to make myself look stupid.
I copypasted the table from my local machine's output into rubular.
Turns out the test runner uses commas a decimal separators, while my local machine uses periods. That is all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With