Voici la documentation : https://geoplateforme.pages.gpf-tech.ign.fr/documentation

Skip to content
Extraits de code Groupes Projets
Valider 211f958e rédigé par Benoit Ducarouge's avatar Benoit Ducarouge
Parcourir les fichiers

Merge branch 'add-ci-cd' into 'main'

add CI/CD

See merge request !2
parents ae1efa83 050ecd3b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!2add CI/CD
Pipeline #8742 réussi avec des avertissements avec les étapes
in 10 minutes et 41 secondes
stages:
- lint
- test
- build
- deploy
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE != "merge_request_event"'
# Templates
include:
- template: Security/SAST.gitlab-ci.yml
- project: geoplateforme/templates
ref: main
file:
- "/ci/docker-v2.yml"
- "/ci/dependency-track.yml"
- "/ci/sonarqube.yml"
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PIP_DISABLE_PIP_VERSION_CHECK: 1
PIP_EXTRA_INDEX_URL: https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_API_V4_URL}/groups/55/-/packages/pypi/
PIP_PROGRESS_BAR: "off"
PIP_RETRIES: 0
PROJECT_FOLDER: "gpf_pyramide_raster"
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
key:
files:
- requirements/*.txt
paths:
- .cache/pip
# -- LINT JOBS -------------------------------------------------------------------------
git-hooks:
stage: lint
image: 690uto8c.gra7.container-registry.ovh.net/gpf-dockerhub/library/python:3.9
variables:
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
cache:
paths:
- ${PRE_COMMIT_HOME}
# only:
# refs:
# - merge_requests
before_script:
- apt install git
- python3 -m pip install -U pip
- python3 -m pip install -U setuptools wheel
- python3 -m pip install -U -r requirements/development.txt
- pre-commit install
- git fetch origin
script:
- pre-commit run --from-ref "origin/$CI_DEFAULT_BRANCH" --to-ref "$CI_COMMIT_SHA";
flake8:
stage: lint
image: 690uto8c.gra7.container-registry.ovh.net/gpf-dockerhub/library/python:3.9-slim-bullseye
only:
changes:
- "**/*.py"
before_script:
- python3 -m pip install -U -r requirements/development.txt
script:
- flake8 $PROJECT_FOLDER --count --select=E9,F63,F7,F82 --show-source --statistics
- flake8 $PROJECT_FOLDER --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# -- TEST JOBS --------------------------------------------------------------------------
sast:
stage: test
# -- TEST JOBS --------------------------------------------------------------------------
test:
stage: test
image: 690uto8c.gra7.container-registry.ovh.net/gpf-dockerhub/osgeo/gdal:ubuntu-small-latest
# filter disabled because sonar job requires it and always runs...
# only:
# changes:
# - "**/*.py"
# - ".gitlab-ci.yml"
# - sonar-project.properties
# refs:
# - main
# - merge_requests
# - tags
before_script:
- apt update -qq
- apt upgrade -y -q
- apt install -y git python3-pip
- python3 -m pip install -U -r requirements.txt
- python3 -m pip install -U -r requirements/testing.txt
- python3 -m pip install -e .
script:
- pytest
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
when: always
paths:
- coverage.xml
- junit/test-results.xml
reports:
junit: junit/test-results.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml
# -- BUILD JOBS -------------------------------------------------------------------------
build:pip-wheel:
stage: build
image: 690uto8c.gra7.container-registry.ovh.net/gpf-dockerhub/osgeo/gdal:ubuntu-small-latest
only:
refs:
- main
- tags
before_script:
- apt update -qq
- apt upgrade -y -q
- apt install -y git python3-pip
- python -m pip install -U -r requirements.txt
- python -m pip install -e .
script:
- python setup.py sdist bdist_wheel
artifacts:
paths:
- .pypirc # required by job gitlab:pypi
- dist/*
build:documentation:licenses:
stage: build
image: 690uto8c.gra7.container-registry.ovh.net/gpf-dockerhub/osgeo/gdal:ubuntu-small-latest
only:
refs:
- main
- tags
before_script:
- apt update -qq
- apt upgrade -y -q
- apt install -y git python3-pip
- python -m pip install -U pip setuptools wheel
- python -m pip install -U "pip-licenses>=3.5,<5"
- python -m pip install -U -r requirements.txt
- python -m pip install -e .
script:
- pip-licenses --format=markdown --with-authors --with-description --with-urls --output-file=docs/misc/licenses.md
artifacts:
name: documentation
expose_as: "License page"
paths:
- docs/misc/licenses.md
when: always
build:documentation:
stage: build
image: 690uto8c.gra7.container-registry.ovh.net/gpf-dockerhub/osgeo/gdal:ubuntu-small-latest
only:
refs:
- main
- tags
needs:
- job: build:documentation:licenses
artifacts: true
before_script:
- apt update -qq
- apt upgrade -y -q
- apt install -y git python3-pip
- python3 -m pip install -U -r requirements.txt
- python3 -m pip install -U -r requirements/documentation.txt
- python3 -m pip install -e .
script:
- sphinx-build -b html -d docs/_build/cache -j auto -q docs build/docs
artifacts:
name: documentation
expose_as: "Built documentation static website"
paths:
- build/docs
when: always
# -- DEPLOYMENT JOBS -------------------------------------------------------------------
gitlab:pypi:
stage: deploy
image: 690uto8c.gra7.container-registry.ovh.net/gpf-dockerhub/library/python:3.9-slim-bullseye
variables:
GIT_STRATEGY: none
TWINE_PASSWORD: "${CI_JOB_TOKEN}"
TWINE_USERNAME: "gitlab-ci-token"
TWINE_REPOSITORY_URL: "https://gitlab.gpf-tech.ign.fr/api/v4/projects/${CI_PROJECT_ID}/packages/pypi"
needs:
- job: build:pip-wheel
artifacts: true
only:
- tags
before_script:
- ls -lavh dist/
- python -m pip install --upgrade pip setuptools wheel
script:
- python -m pip install -U "twine<5"
- python -m twine check dist/*
- python -m twine upload --verbose dist/*
release_job:
stage: deploy
image: registry.gitlab.com/gitlab-org/release-cli:latest
variables:
GIT_STRATEGY: none
only:
- tags
needs:
- job: build:pip-wheel
artifacts: true
- job: gitlab:pypi
artifacts: false
script:
- echo "Creating release from $CI_COMMIT_TAG"
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: "$CI_COMMIT_TAG"
description: "$CI_COMMIT_TAG"
pages:
stage: deploy
variables:
GIT_STRATEGY: none
only:
changes:
- "**/*.md"
- ".gitlab-ci.yml"
- "$PROJECT_FOLDER/**/*"
- requirements/documentation.txt
refs:
- main
- tags
needs:
- build:documentation
script:
- mkdir -p public
# copy HTML documentation
- cp -rf build/docs/* public/
artifacts:
paths:
- public
when: always
exclude: ".venv|__pycache__|tests/dev/|tests/fixtures/"
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
args: ["--maxkb=500"]
- id: check-case-conflict
- id: check-toml
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: fix-encoding-pragma
args: [--remove]
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args:
[
"--config=setup.cfg",
"--select=E9,F63,F7,F82,D103",
]
ci:
autoupdate_schedule: quarterly
skip: []
submodules: false
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter