From 8fcb86e47353a4ecf0ae7e1adc19e9be9158e8dc Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Tue, 24 May 2022 16:08:56 +0200 Subject: [PATCH] ci: add GitLab CI Signed-off-by: Matej Focko --- .gitlab-ci.yml | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..6fdfab9 --- /dev/null +++ b/.gitlab-ci.yml @@ -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 diff --git a/Makefile b/Makefile index 78d20ce..7ba97c4 100644 --- a/Makefile +++ b/Makefile @@ -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