Fix the coverage badge on GitLab by producing an XML report

This commit is contained in:
Raoul Snyman 2023-12-07 10:47:53 -07:00
parent fb4409792d
commit 5a8b57923f
2 changed files with 13 additions and 2 deletions

1
.gitignore vendored
View File

@ -33,6 +33,7 @@ __pycache__
build build
cover cover
coverage coverage
coverage.xml
dist dist
env env
htmlcov htmlcov

View File

@ -24,11 +24,16 @@ test-debian:
image: $IMAGE_BASE/debian image: $IMAGE_BASE/debian
script: script:
- sh scripts/generate_resources.sh - sh scripts/generate_resources.sh
- xvfb-run -s '-screen 0 1024x768x24' pytest-3 --color=no --disable-warnings --cov openlp --cov-report term - xvfb-run -s '-screen 0 1024x768x24' pytest-3 --color=no --disable-warnings --cov openlp --cov-report term --cov-report xml:coverage.xml
- mv .coverage linux.coverage - mv .coverage linux.coverage
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts: artifacts:
paths: paths:
- linux.coverage - linux.coverage
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
test-ubuntu: test-ubuntu:
stage: test stage: test
@ -102,11 +107,16 @@ pages:
- python3-coverage combine linux.coverage macos.coverage - python3-coverage combine linux.coverage macos.coverage
- python3-coverage html - python3-coverage html
- mv htmlcov public - mv htmlcov public
- python3-coverage report - python3-coverage xml
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts: artifacts:
paths: paths:
- public - public
expire_in: 30 days expire_in: 30 days
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
dependencies: dependencies:
- test-debian - test-debian
- test-macos-intel - test-macos-intel