gitlab-ci: generate test coverage

This commit is contained in:
InsanePrawn 2022-08-20 05:59:31 +02:00
parent 70c4799385
commit 97d3f05968
2 changed files with 7 additions and 4 deletions

View file

@ -27,16 +27,19 @@ pytest:
image: archlinux
before_script:
- pacman -Sy --noconfirm --needed archlinux-keyring && pacman -Su --noconfirm python python-pip sudo git base-devel
- pip install pytest -r requirements.txt
- pip install pytest pytest-cov -r requirements.txt
- 'echo "kupfer ALL = (ALL) NOPASSWD: ALL" > /etc/sudoers.d/kupfer_all'
- useradd -m kupfer
- chmod 777 .
script:
- script -e -c 'su kupfer -s /bin/bash -c ./pytest.sh'
- script -e -c 'su kupfer -s /bin/bash -c "./pytest.sh --cov=. --cov-branch --cov-report=term --cov-report=xml:coverage.xml"'
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
reports:
junit: pytest-report.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml
build_docker:
stage: build
image: docker:latest

View file

@ -1,4 +1,4 @@
#!/bin/bash
sudo -v
python -m pytest --junit-xml=pytest-report.xml -v ./*/test_*.py
python -m pytest --junit-xml=pytest-report.xml -v "$@" ./*/test_*.py