ci: add GitLab CI

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2022-05-24 16:08:56 +02:00
parent dc6905b5e2
commit 8fcb86e473
Signed by: mfocko
GPG key ID: 7C47D46246790496
2 changed files with 54 additions and 1 deletions

53
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,53 @@
image: python:latest
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
- venv/
before_script:
- python --version
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
black:
stage: test
script:
- pip install black
- make black
flake8:
stage: test
script:
- pip install flake8
- make flake8
pytest:
stage: test
script:
- pip install hypothesis pytest pytest-cov
- make check
artifacts:
when: always
reports:
junit: report.xml
test_coverage:
stage: test
script:
- pip install hypothesis pytest pytest-cov
- coverage run -m pytest
- coverage report
- coverage xml
coverage: '/TOTAL.*\s([.\d]+)%/'
artifacts:
when: always
reports:
junit: report.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml

View file

@ -1,5 +1,5 @@
check:
pytest -vvv --log-level debug --cov --cov-report=term-missing
pytest -vvv --log-level debug --cov --cov-report=term-missing --junitxml=report.xml
lint: black flake8 mypy