Skip to content
Snippets Groups Projects
Commit 79e09279 authored by Moul's avatar Moul
Browse files

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

- Use our built images
- Checks: build, format
- tests: Python v3.5, 3.6, 3.7, and 3.8
- #105: PyPi and PyPi test distributions
- Coverage published to GitLab Pages
- Use Black installed from Docker image v3.8 as black is only available on Buster
parent 38a4a907
No related branches found
No related tags found
No related merge requests found
stages:
- checks
- tests
- publish
- coverage
variables:
DOCKER_IMAGE: "registry.duniter.org/docker/python3/poetry"
image: $DOCKER_IMAGE/3.7:latest
.code_changes:
only:
changes:
- bin/silkaj
- silkaj/*.py
- tests/*.py
.changes:
extends: .code_changes
only:
changes:
- .gitlab-ci.yml
- pyproject.toml
- poetry.lock
build:
extends: .changes
stage: checks
script:
- poetry install --no-dev
- poetry build
format:
extends: .code_changes
stage: checks
image: $DOCKER_IMAGE/3.8:latest
script:
- black --check bin silkaj tests
.type:
extends: .code_changes
stage: checks
script:
- poetry install
- poetry run mypy/pyright
.tests:
extends: .changes
stage: tests
before_script:
- poetry install
tests-3.5:
extends: .tests
image: $DOCKER_IMAGE/3.5:latest
script:
- poetry run pytest
tests-3.6:
extends: .tests
image: $DOCKER_IMAGE/3.6:latest
script:
- poetry run pytest
tests-3.7:
extends: .tests
image: $DOCKER_IMAGE/3.7:latest
script:
- poetry run pytest --cov silkaj --cov-report html:cov_html
artifacts:
paths:
- cov_html
tests-3.8:
extends: .tests
image: $DOCKER_IMAGE/3.8:latest
script:
- poetry run pytest
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 $PYPI_TEST_LOGIN --password $PYPI_TEST_PASSWORD --repository pypi_test
pypi:
stage: publish
only:
- tags
when: manual
script:
- poetry install --no-dev
- poetry publish --build --username $PYPI_LOGIN --password $PYPI_PASSWORD
pages:
extends: .code_changes
stage: coverage
script: mv cov_html/ public/
artifacts:
paths:
- public
expire_in: 2 days
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment