I am trying to setup a coverage badge for a python project on GitLab. I was following this question but it is still not working.
Currently I see in "CI/CD"/jobs
page this:
But when I go to Settings/"CI-CD"/General pipelines
, the coverage report is still unknown:
This is how I defined coverage run in .gitlab-ci.yml
file:
tests:
stage: test
only:
- merge_requests
script:
- pip install poetry
- poetry install
- poetry run coverage run -m pytest
- poetry run coverage report
- poetry run coverage xml
artifacts:
paths: [coverage.xml]
Any ideas what might need to be set differently?
Okay it looks like that I need to add also -main
to only
part of my .gitlab-ci.yml
and then it works. I was just maybe hoping I can have it without running tests twice (before MR to main
and after).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.