diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..41b629bf2f0b5d91a2c4b6680ea143eaac874b77 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,104 @@ +stages: + - checks + - tests + - publish + - coverage + +variables: + DOCKER_IMAGE: "registry.duniter.org/docker/python3/poetry" + PYTHON_VERSION: "3.7" + +image: $DOCKER_IMAGE/$PYTHON_VERSION: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 + +.tests: + extends: .changes + stage: tests + image: $DOCKER_IMAGE/$PYTHON_VERSION:latest + script: + - poetry install + - poetry run pytest + +tests-3.5: + extends: .tests + variables: + PYTHON_VERSION: "3.5" + +tests-3.6: + extends: .tests + variables: + PYTHON_VERSION: "3.6" + +tests-3.7-coverage: + extends: .tests + variables: + PYTHON_VERSION: "3.7" + script: + - poetry run pytest --cov silkaj --cov-report html:cov_html + artifacts: + paths: + - cov_html + +tests-3.8: + extends: .tests + variables: + PYTHON_VERSION: "3.8" + +pypi_test: + stage: publish + extends: .cache + tags: [poetry-78] + only: [tags] + 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 + extends: .cache + tags: [poetry-78] + only: [tags] + when: manual + script: + - poetry install --no-dev + - poetry publish --build --username $PYPI_LOGIN --password $PYPI_PASSWORD + +pages: + extends: .code_changes + needs: [tests-3.7-coverage] + stage: coverage + script: mv cov_html/ public/ + artifacts: + paths: + - public + expire_in: 2 days