gitlab-ci: generate test coverage
This commit is contained in:
parent
70c4799385
commit
97d3f05968
2 changed files with 7 additions and 4 deletions
|
@ -27,16 +27,19 @@ pytest:
|
||||||
image: archlinux
|
image: archlinux
|
||||||
before_script:
|
before_script:
|
||||||
- pacman -Sy --noconfirm --needed archlinux-keyring && pacman -Su --noconfirm python python-pip sudo git base-devel
|
- 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'
|
- 'echo "kupfer ALL = (ALL) NOPASSWD: ALL" > /etc/sudoers.d/kupfer_all'
|
||||||
- useradd -m kupfer
|
- useradd -m kupfer
|
||||||
- chmod 777 .
|
- chmod 777 .
|
||||||
script:
|
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:
|
artifacts:
|
||||||
reports:
|
reports:
|
||||||
junit: pytest-report.xml
|
junit: pytest-report.xml
|
||||||
|
coverage_report:
|
||||||
|
coverage_format: cobertura
|
||||||
|
path: coverage.xml
|
||||||
build_docker:
|
build_docker:
|
||||||
stage: build
|
stage: build
|
||||||
image: docker:latest
|
image: docker:latest
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sudo -v
|
sudo -v
|
||||||
python -m pytest --junit-xml=pytest-report.xml -v ./*/test_*.py
|
python -m pytest --junit-xml=pytest-report.xml -v "$@" ./*/test_*.py
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue