summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Gonzalez <roger@rogs.me>2024-03-09 10:28:07 -0300
committerRoger Gonzalez <roger@rogs.me>2024-03-09 10:28:07 -0300
commitca0f596e373881aaf4f48e654d2451c8d8e1f4b3 (patch)
treec42675f0c97b4e52bba9c771e8c636b9d38a3410
parent787e90907fe09e83545284bff7f140c08b25fe12 (diff)
Added unit tests in the CI
-rw-r--r--.gitignore1
-rw-r--r--.gitlab-ci.yml31
2 files changed, 24 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
index 4277629..56988f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@ tmp/
build
htmlcov
dist
+.coverage
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2f6d473..2607b49 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,13 +1,31 @@
image: python:latest
+stages:
+ - lint
+ - test
+ - deploy
+
+before_script:
+ - pip install poetry
+ - poetry install --no-root
+
lint:
+ stage: lint
+ script:
+ - poetry run ruff check
+ - poetry run ruff format --check
+
+test:
stage: test
- before_script:
- - pip install poetry
- - poetry install --no-root
script:
- - poetry run ruff check ./src
- - poetry run ruff format --check ./src
+ - poetry run pytest --cov=. --cov-report=xml
+ after_script:
+ - bash <(curl -s https://codecov.io/bash)
+ artifacts:
+ reports:
+ coverage_report:
+ coverage_format: cobertura
+ path: coverage.xml
deploy_to_pypi:
stage: deploy
@@ -16,8 +34,5 @@ deploy_to_pypi:
- master
changes:
- pyproject.toml
- before_script:
- - pip install poetry
- - poetry install --no-root
script:
- POETRY_PYPI_TOKEN_PYPI=$PYPI_PASSWORD poetry publish --build