diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8919e1801d85955a316994a8da5f7409391f6d75..47a50aee8efd29b1112708df86d5361106ad3ac2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,6 +20,8 @@ include: - "/ci/sonarqube.yml" - "/ci/package-py.yml" - "/ci/versioning.yml" + - "/ci/test-py.yml" + - "/ci/deploy-py.yml" # Change pip's cache directory to be inside the project directory since we can # only cache local items. @@ -32,6 +34,11 @@ variables: PIP_RETRIES: 0 PROJECT_FOLDER: "gpf_agent_geoserver" PYTHON_VERSION_MIN: "3.10" + PIP_INSTALL_TEST: "true" + INSTALL_BUILD_EXTRA_DEPS: "true" + BUILD_EXTRA_DEPS: "git python3-pip" + PIP_INSTALL_BUILD_CREDITS: "true" + PIP_INSTALL_BUILD_DOCUMENTATION: "true" # Pip's cache doesn't store the python packages # https://pip.pypa.io/en/stable/reference/pip_install/#caching @@ -46,184 +53,9 @@ cache: - ${PIP_CACHE_DIR} - ${PRE_COMMIT_HOME} -# -- LINT JOBS ------------------------------------------------------------------------- -flake8: - stage: lint - image: ${IMAGE_REGISTRY}/library/python:${PYTHON_VERSION_MIN}-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: ${IMAGE_REGISTRY}/library/python:${PYTHON_VERSION_MIN}-slim-bullseye - 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: ${IMAGE_REGISTRY}/library/python:${PYTHON_VERSION_MIN}-slim-bullseye - 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 -U build - script: - - python -m build --no-isolation --sdist --wheel --outdir dist/ . - artifacts: - paths: - - .pypirc # required by job gitlab:pypi - - dist/* - -build:documentation:credits: - stage: build - image: ${IMAGE_REGISTRY}/library/python:${PYTHON_VERSION_MIN}-slim-bullseye - only: - refs: - - main - - tags - before_script: - - python -m pip install -U pip setuptools wheel - - python -m pip install -U "pip-licenses>=3.5,<5" - - python -m pip install -U "pipdeptree>=2.7,<3" - - python -m pip install -U -r requirements.txt - - python -m pip install -e . - script: - - echo -e "\`\`\`{mermaid}" > docs/misc/dependencies.md - - pipdeptree --exclude pip,pipdeptree,pip-licenses,prettytable,setuptools,wheel --mermaid >> docs/misc/dependencies.md - - echo -e "\`\`\`" >> docs/misc/dependencies.md - - pip-licenses --format=markdown --with-authors --with-description --with-urls --output-file=docs/misc/licenses.md --ignore-packages pip,pipdeptree,prettytable,setuptools,wheel - artifacts: - name: doc_autogenerated - expose_as: Credits - paths: - - docs/misc/dependencies.md - - docs/misc/licenses.md - when: always - -build:documentation: - stage: build - image: ${IMAGE_REGISTRY}/library/python:${PYTHON_VERSION_MIN}-slim-bullseye - only: - refs: - - main - - tags - needs: - - job: build:documentation:credits - artifacts: true - before_script: - - 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 ------------------------------------------------------------------- -release:prepare: - stage: deploy - allow_failure: true - image: - name: ${IMAGE_REGISTRY}/alpine/git:latest - entrypoint: [""] - script: - - echo -e '## Changelog\n' >> RELEASE_DESCRIPTION.md - - git tag -l -n9 $CI_COMMIT_TAG >> RELEASE_DESCRIPTION.md - - echo -e '\n### Merges\n' >> RELEASE_DESCRIPTION.md - - git log --merges --pretty="- %s (%h)" $(git tag --sort=-creatordate | head -2)...$(git tag --sort=-creatordate | head -1) >> RELEASE_DESCRIPTION.md - - echo -e '\n### AUTHORS\n' >> RELEASE_DESCRIPTION.md - - git log --pretty="- %an%n- %cn" $(git tag --sort=-creatordate | head -2)...$(git tag --sort=-creatordate | head -1) | sort | uniq >> RELEASE_DESCRIPTION.md - artifacts: - paths: - - RELEASE_DESCRIPTION.md - only: - - tags - -release:publish: - 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 - - job: release:prepare - artifacts: true - script: - - echo "Creating release from $CI_COMMIT_TAG" - release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties - description: RELEASE_DESCRIPTION.md - name: $CI_COMMIT_TAG - tag_name: "$CI_COMMIT_TAG" - - artifacts: - paths: - - RELEASE_DESCRIPTION.md - expire_in: never - -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 + extends: .test diff --git a/CHANGELOG.md b/CHANGELOG.md index 523ddbe3126b5d5be950f1a550f3ff0973203332..85dfebcf0e0a56669b25f0fc8b91976c0bbe2d88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/). ## [Unreleased] +### Changed +- chore IGNGPF-4052 - retrieve ci jobs from template ## [2.14.0] - 2025-02-05 ### Fixed