I have created a very simple example: https://gitlab.com/mvfwd/gitlab-coverage.
Unfortunately gitlab does not show Cobertura coverage visualisation.
Here is my .gitlab-ci.yml
:
image: python:3
stages:
- test
coverage:
stage: test
script:
- pip install coverage
- coverage run ./main.py
- coverage report -m
- coverage xml
artifacts:
paths:
- ./coverage.xml
reports:
cobertura: ./coverage.xml
only:
- master
In logs I can see that coverage report is uploaded (link):
$ coverage run ./main.py
..
----------------------------------------------------------------------
Ran 2 tests in 0.001s
OK
$ coverage report -m
Name Stmts Miss Cover Missing
---------------------------------------
main.py 26 12 54% 9-14, 20-25
---------------------------------------
TOTAL 26 12 54%
$ coverage xml
Uploading artifacts for successful job
00:03
Uploading artifacts...
./coverage.xml: found 1 matching files and directories
Uploading artifacts as "archive" to coordinator... ok id=1450561054 responseStatus=201 Created token=eZqc9KYb
Uploading artifacts...
./coverage.xml: found 1 matching files and directories
Uploading artifacts as "cobertura" to coordinator... ok id=1450561054 responseStatus=201 Created token=eZqc9KYb
Cleaning up file based variables
00:00
Job succeeded
What am I doing wrong?
I have filed an issue and solution was found. Here is the recap:
master
to main
, documenation examples were not updated and I copied that to my .gitlab-ci.yml
, which prevented autostarting pipelines on commitIf 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