Skip to content
Snippets Groups Projects

#118: Set up complete CI/CD pipeline

Merged Moul requested to merge 118_enh_ci into dev
Compare and
1 file
+ 56
44
Compare changes
  • Side-by-side
  • Inline
+ 56
44
stages:
- format
- test
- build
- checks
- tests
- release
- publish_doc
variables:
DOCKER_IMAGE: "registry.duniter.org/docker/python3/poetry"
PYTHON_VERSION: "3.6"
PYTHON_VERSION: "3.8"
image: $DOCKER_IMAGE/$PYTHON_VERSION:latest
# SUB-TASKS
.push_to_github:
tags:
- github
after_script:
# remove all files in current repo
- rm -rf ./*
- rm -rf .git*
# do a mirror clone in current repo
- git clone --mirror $CI_REPOSITORY_URL .
# do config for github push
- git remote add github $GITHUB_URL_AND_KEY
- git config --global user.email "contact@duniter.org"
- git config --global user.name "Duniter"
# remove refs about merge requests
- bash -c "cat packed-refs | grep -v 'refs/merge-requests' > packed-refs-new; echo 'Removed merge-requests refs.'"
- mv packed-refs-new packed-refs
# github push
- bash -c "git push --force --mirror github 2>&1 | grep -v duniter-gitlab; echo $?"
.code_changes:
only:
changes:
- duniterpy/**/*.py
- tests/**/*.py
- examples/*.py
.changes:
rules:
- changes:
- duniterpy/**/*.py
- tests/**/*.py
- examples/*.py
- .gitlab-ci.yml
- Makefile
- tests/**/*.py
- pyproject.toml
# TASKS
format:
extends:
- .changes
stage: format
image: $DOCKER_IMAGE/3.8:latest
- .code_changes
stage: checks
script:
- make check-format
test:
build:
extends:
- .changes
stage: test
stage: checks
script:
- poetry install --no-dev
- make tests
- poetry build
check:
type:
extends:
- .changes
stage: test
- .code_changes
stage: checks
script:
- poetry install
- make mypy
- make pylint
build:
lint:
extends:
- .changes
stage: build
- .code_changes
stage: tests
tags: [redshift]
script:
- poetry build
- poetry install
- make pylint
.tests:
extends: .changes
stage: tests
image: $DOCKER_IMAGE/$PYTHON_VERSION:latest
script:
- poetry install --no-dev
- make tests
tests-3.6:
extends: .tests
tags: [mille]
variables:
PYTHON_VERSION: "3.6"
tests-3.7:
extends: .tests
tags: [mille]
variables:
PYTHON_VERSION: "3.7"
tests-3.8:
extends: .tests
tags: [redshift]
tests-3.9:
extends: .tests
tags: [redshift]
variables:
PYTHON_VERSION: "3.9"
release:
extends:
- .push_to_github
stage: release
script:
- poetry publish --build --username $PYPI_LOGIN --password $PYPI_PASSWORD
@@ -102,7 +114,7 @@ pages:
stage: publish_doc
script:
- poetry install
- poetry run make docs
- make docs
- mv docs/_build/html public
- ls public
artifacts:
Loading