Skip to content

Commit

Permalink
add .gitlab-ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
muddymudskipper committed Jul 18, 2024
1 parent 1fb6952 commit ea6e8ff
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
default:
image: docker-registry.eccenca.com/eccenca-python:v3.11.4
# all jobs can be interrupted in case a new commit is pushed
interruptible: true
before_script:
# make sure poetry creates virtual environment as .venv
- poetry config virtualenvs.in-project true
cache:
# cache the virtual environment based on the poetry lock file
key:
files:
- poetry.lock
paths:
- .venv

stages:
- test
- build
- publish

ruff:
stage: test
script:
- task check:ruff
artifacts:
when: always
reports:
junit:
- dist/junit-ruff.xml

mypy:
stage: test
script:
- task check:mypy
artifacts:
when: always
reports:
junit:
- dist/junit-mypy.xml

pytest:
stage: test
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
script:
- task check:pytest
artifacts:
when: always
reports:
coverage_report:
coverage_format: cobertura
path: dist/coverage.xml
junit:
- dist/junit-pytest.xml
paths:
- dist/badge-coverage.svg
- dist/badge-tests.svg
- dist/coverage
- dist/coverage.xml

safety:
stage: test
script:
- task check:safety

build:
stage: build
needs:
- mypy
- pytest
- safety
script:
- task build
artifacts:
when: always
paths:
- dist/*.tar.gz
- dist/*.whl

pypi:
# publishing only available on a tag
stage: publish
needs:
- ruff
- build
allow_failure: true
when: manual
script:
- poetry config pypi-token.pypi $PYPI_TOKEN
- poetry publish

0 comments on commit ea6e8ff

Please sign in to comment.