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
3 files
+ 67
48
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 57
45
stages:
stages:
- format
- checks
- test
- tests
- build
- release
- release
- publish_doc
- publish_doc
variables:
variables:
DOCKER_IMAGE: "registry.duniter.org/docker/python3/poetry"
DOCKER_IMAGE: "registry.duniter.org/docker/python3/poetry"
PYTHON_VERSION: "3.5"
PYTHON_VERSION: "3.8"
image: $DOCKER_IMAGE/$PYTHON_VERSION:latest
image: $DOCKER_IMAGE/$PYTHON_VERSION:latest
# SUB-TASKS
.code_changes:
.push_to_github:
only:
tags:
changes:
- github
- duniterpy/**/*.py
after_script:
- tests/**/*.py
# remove all files in current repo
- examples/*.py
- 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 $?"
.changes:
.changes:
rules:
rules:
- changes:
- changes:
- duniterpy/**/*.py
- duniterpy/**/*.py
 
- tests/**/*.py
 
- examples/*.py
- .gitlab-ci.yml
- .gitlab-ci.yml
- Makefile
- Makefile
- tests/**/*.py
- pyproject.toml
- pyproject.toml
# TASKS
format:
format:
extends:
extends:
- .changes
- .code_changes
stage: format
stage: checks
image: $DOCKER_IMAGE/3.8:latest
script:
script:
- make check-format
- make check-format
test:
build:
extends:
extends:
- .changes
- .changes
stage: test
stage: checks
script:
script:
- poetry install --no-dev
- poetry build
- make tests
check:
type:
extends:
extends:
- .changes
- .code_changes
stage: test
stage: checks
script:
script:
- poetry install
- make mypy
- make mypy
- make pylint
build:
lint:
extends:
extends:
- .changes
- .code_changes
stage: build
stage: checks
script:
script:
- poetry build
- poetry config virtualenvs.in-project true
 
- poetry install --no-dev
 
- make pylint
 
 
.tests:
 
extends: .changes
 
stage: tests
 
image: $DOCKER_IMAGE/$PYTHON_VERSION:latest
 
script:
 
- poetry install --no-dev
 
- make tests
 
 
tests-3.5:
 
extends: .tests
 
tags: [poetry-56]
 
variables:
 
PYTHON_VERSION: "3.5"
 
 
tests-3.6:
 
extends: .tests
 
tags: [poetry-56]
 
variables:
 
PYTHON_VERSION: "3.6"
 
 
tests-3.7:
 
extends: .tests
 
tags: [poetry-78]
 
variables:
 
PYTHON_VERSION: "3.7"
 
 
tests-3.8:
 
extends: .tests
 
tags: [poetry-78]
release:
release:
extends:
- .push_to_github
stage: release
stage: release
script:
script:
- poetry publish --build --username $PYPI_LOGIN --password $PYPI_PASSWORD
- poetry publish --build --username $PYPI_LOGIN --password $PYPI_PASSWORD
@@ -102,7 +114,7 @@ pages:
@@ -102,7 +114,7 @@ pages:
stage: publish_doc
stage: publish_doc
script:
script:
- poetry install
- poetry install
- poetry run make docs
- make docs
- mv docs/_build/html public
- mv docs/_build/html public
- ls public
- ls public
artifacts:
artifacts:
@@ -114,4 +126,4 @@ pages:
@@ -114,4 +126,4 @@ pages:
when: manual
when: manual
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_BRANCH == "master"
when: manual
when: manual
- when: never
- when: never
\ No newline at end of file
Loading