Commit 5f2f4ece authored by Moul's avatar Moul

[enh] #149: Add CI/CD .gitlab-ci.yml

- Checks: build, format, tests
- Publish: PyPi and PyPi test
- Coverage published to GitLab Pages
parent 94ae0e15
stages:
- checks
- publish
- coverage
image: michalmazurek/python-poetry:3.7.2-slim-stretch
.code_changes: &code_changes
only:
changes:
- bin/silkaj
- silkaj/*.py
- tests/*.py
.changes: &changes
<<: *code_changes
only:
changes:
- .gitlab-ci.yml
- pyproject.toml
- poetry.lock
build:
<<: *changes
stage: checks
script:
- poetry install --no-dev
- poetry build
format:
<<: *code_changes
stage: checks
script:
- poetry install
- poetry run black --check bin silkaj tests
.type:
<<: *code_changes
stage: checks
script:
- poetry install
- poetry run mypy/pyright
tests:
<<: *changes
stage: checks
script:
- apt update
- apt install --yes libsodium18
- poetry install
- poetry run pytest --cov silkaj --cov-report html:cov_html
artifacts:
paths:
- cov_html
pypi_test:
stage: publish
when: manual
script:
- poetry install --no-dev
- poetry config repositories.pypi_test https://test.pypi.org/legacy/
- poetry publish --build --username Silkaj --password $PYPI_TEST_PASSWORD --repository pypi_test
pypi:
stage: publish
only:
- tags
when: manual
script:
- poetry install --no-dev
- poetry publish --build --username GitLab --password $PYPI_PASSWORD
pages:
<<: *code_changes
stage: coverage
script: mv cov_html/ public/
artifacts:
paths:
- public
expire_in: 2 days
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment