357 lines
8.0 KiB
YAML
357 lines
8.0 KiB
YAML
workflow:
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH =~ /^topic\/.*/ && $CI_PIPELINE_SOURCE == "push"
|
|
when: never
|
|
- when: always
|
|
|
|
stages:
|
|
- preparation
|
|
- check
|
|
- test
|
|
- build
|
|
|
|
packages:
|
|
stage: preparation
|
|
rules:
|
|
- when: always
|
|
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/tryton/ci
|
|
variables:
|
|
DOC_BASE_URL: ${CI_PROJECT_DIR}/docs
|
|
script:
|
|
- .gitlab-scripts/generate-packages.sh packages
|
|
artifacts:
|
|
paths:
|
|
- packages/
|
|
expire_in: 1 week
|
|
|
|
documentation:
|
|
stage: preparation
|
|
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/sphinxdoc/sphinx
|
|
script:
|
|
- .gitlab-scripts/generate-doc.sh docs
|
|
artifacts:
|
|
paths:
|
|
- docs/
|
|
expire_in: 1 week
|
|
rules:
|
|
- changes:
|
|
- "**/*/doc/**/*"
|
|
- "**/*/tryton.cfg"
|
|
- "**/*/CHANGELOG"
|
|
- "readthedocs/**/*"
|
|
|
|
.check:
|
|
stage: check
|
|
needs: []
|
|
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/tryton/ci
|
|
|
|
.check-doc:
|
|
extends: .check
|
|
needs:
|
|
- documentation
|
|
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/sphinxdoc/sphinx
|
|
variables:
|
|
DOC_BASE_URL: ${CI_PROJECT_DIR}/docs
|
|
DOC_DIR: doc
|
|
cache:
|
|
paths:
|
|
- .cache/pip/http
|
|
before_script:
|
|
- pip install sphinx-lint rstcheck[sphinx]
|
|
script:
|
|
- cd "${PACKAGE}"
|
|
- python -m sphinx -T -E -W -n -b html ${DOC_DIR} _build/html
|
|
- python -m sphinxlint ${DOC_DIR}
|
|
- rstcheck --recursive ${DOC_DIR}
|
|
- |
|
|
if [ "${CHECK_LINK}" ]; then
|
|
python -m sphinx -T -E -W -n -b linkcheck ${DOC_DIR} _build;
|
|
fi
|
|
rules:
|
|
- if: $CI_COMMIT_TAG == null
|
|
changes:
|
|
- ${PACKAGE}/${DOC_DIR}/**/*
|
|
- ${PACKAGE}/tryton.cfg
|
|
- ${PACKAGE}/CHANGELOG
|
|
when: on_success
|
|
- when: never
|
|
|
|
.check-doc-readme:
|
|
extends: .check-doc
|
|
script:
|
|
- python -m sphinxlint README.rst
|
|
- rstcheck README.rst
|
|
rules:
|
|
- if: $CI_COMMIT_TAG == null
|
|
changes:
|
|
- README.rst
|
|
when: on_success
|
|
- when: never
|
|
|
|
check-doc-readthedocs:
|
|
extends: .check-doc
|
|
variables:
|
|
PACKAGE: readthedocs
|
|
DOC_DIR: .
|
|
rules:
|
|
- if: $CI_COMMIT_TAG == null
|
|
changes:
|
|
- ${PACKAGE}/**/*
|
|
when: on_success
|
|
- when: never
|
|
|
|
.check-code:
|
|
extends: .check
|
|
rules:
|
|
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
|
|
when: always
|
|
|
|
check-flake8:
|
|
extends: .check-code
|
|
script:
|
|
- flake8 --exclude 'cookiecutter*'
|
|
|
|
check-isort:
|
|
extends: .check-code
|
|
script:
|
|
- isort --multi-line VERTICAL_GRID --check --diff --skip-glob 'cookiecutter*' .
|
|
|
|
check-dist:
|
|
stage: check
|
|
needs:
|
|
- packages
|
|
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/tryton/ci
|
|
script:
|
|
- twine check packages/*
|
|
|
|
check-ci-modules:
|
|
extends: .check
|
|
script:
|
|
- python .gitlab-scripts/generate-ci.py $TMPDIR/gitab-ci-modules.yml
|
|
- cmp .gitlab-ci-modules.yml $TMPDIR/gitab-ci-modules.yml
|
|
|
|
check-cookiecutter-module:
|
|
extends: .check
|
|
cache:
|
|
paths:
|
|
- .cache/pip/http
|
|
before_script:
|
|
- pip install cookiecutter
|
|
script:
|
|
- cookiecutter --no-input cookiecutter-module -o /tmp
|
|
- flake8 /tmp/my_module
|
|
- isort --multi-line VERTICAL_GRID --check --diff /tmp/my_module
|
|
rules:
|
|
- changes:
|
|
- cookiecutter-module/**/*
|
|
|
|
.test:
|
|
stage: test
|
|
rules:
|
|
- if: $CI_COMMIT_TAG == null
|
|
changes:
|
|
- ${PACKAGE}/**/*
|
|
when: on_success
|
|
- if: '$CI_COMMIT_TAG =~ $TAG_PATTERN'
|
|
when: on_success
|
|
- when: never
|
|
|
|
.test-tox:
|
|
extends: .test
|
|
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/python:${PYTHON_VERSION}
|
|
variables:
|
|
PIP_FIND_LINKS: file://${CI_PROJECT_DIR}/packages/
|
|
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
|
cache:
|
|
paths:
|
|
- .cache/pip/http
|
|
before_script:
|
|
- pip install tox
|
|
script:
|
|
- tox -e "py${PYTHON_VERSION/./}" -c "${PACKAGE}" -vv -- -v --output-file junit.xml
|
|
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
|
|
artifacts:
|
|
reports:
|
|
junit: ${PACKAGE}/junit.xml
|
|
coverage_report:
|
|
coverage_format: cobertura
|
|
path: ${PACKAGE}/coverage.xml
|
|
parallel:
|
|
matrix:
|
|
- PYTHON_VERSION: ["3.8", "3.9", "3.10", "3.11"]
|
|
|
|
.test-db:
|
|
extends: .test-tox
|
|
variables:
|
|
DB_CACHE: /tmp/cache
|
|
script:
|
|
- tox -e "py${PYTHON_VERSION/./}-${DATABASE}" -c "${PACKAGE}" -vv -- -v --output-file junit.xml
|
|
|
|
.test-sqlite:
|
|
extends: .test-db
|
|
variables:
|
|
DATABASE: sqlite
|
|
|
|
.test-postgresql:
|
|
extends: .test-db
|
|
variables:
|
|
DATABASE: postgresql
|
|
POSTGRESQL_URI: postgresql://postgres@postgresql:5432/
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
services:
|
|
- name: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/postgres
|
|
alias: postgresql
|
|
command: ["-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
|
|
|
|
.test-postgis:
|
|
extends: .test-db
|
|
variables:
|
|
DATABASE: postgis
|
|
POSTGIS_URI: postgis://postgres@postgis:5432/
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
script:
|
|
- tox -e "py${PYTHON_VERSION/./}" -c "${PACKAGE}" -vv -- -v --output-file junit.xml
|
|
services:
|
|
- name: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/postgis/postgis
|
|
alias: postgis
|
|
command: ["-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
|
|
|
|
.test-npm:
|
|
extends: .test
|
|
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/node
|
|
variables:
|
|
NODE_CACHE_DIR: "$CI_PROJECT_DIR/.cache/npm"
|
|
cache:
|
|
paths:
|
|
- .cache/npm
|
|
before_script:
|
|
- sh .gitlab-scripts/bower_allow_root.sh
|
|
script:
|
|
- cd "${PACKAGE}"
|
|
- npm -s install --cache ${NODE_CACHE_DIR} --unsafe-perm --legacy-peer-deps
|
|
- npm test
|
|
artifacts:
|
|
reports:
|
|
junit: ${PACKAGE}/_build/test-reports/*.xml
|
|
|
|
.trigger-doc-build:
|
|
stage: build
|
|
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/tryton/ci
|
|
script:
|
|
- .gitlab-scripts/trigger-readthedocs.py -c "${RTD_CONFIG}" -p "${PACKAGE}" -b "${CI_COMMIT_BRANCH#branch/}"
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH =~ /^branch\/.*/
|
|
changes:
|
|
- ${PACKAGE}/doc/**/*
|
|
- ${PACKAGE}/tryton.cfg
|
|
- ${PACKAGE}/CHANGELOG
|
|
allow_failure: true
|
|
|
|
trigger-doc-build-readthedocs:
|
|
extends: .trigger-doc-build
|
|
variables:
|
|
PACKAGE: readthedocs
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH =~ /^branch\/.*/
|
|
changes:
|
|
- ${PACKAGE}/**/*
|
|
allow_failure: true
|
|
|
|
check-doc-trytond:
|
|
extends: .check-doc
|
|
variables:
|
|
PACKAGE: trytond
|
|
|
|
check-trytond-rng:
|
|
extends: .check
|
|
cache:
|
|
paths:
|
|
- .cache/pip/http
|
|
before_script:
|
|
- pip install rnc2rng
|
|
script:
|
|
- python trytond/setup.py update_rng
|
|
- |
|
|
if [ `hg status trytond| wc -l` -ne 0 ]; then
|
|
false
|
|
fi
|
|
rules:
|
|
- changes:
|
|
- trytond/**/*.rnc
|
|
- trytond/**/*.rng
|
|
|
|
trigger-doc-build-trytond:
|
|
extends: .trigger-doc-build
|
|
variables:
|
|
PACKAGE: trytond
|
|
|
|
test-trytond-sqlite:
|
|
extends: .test-sqlite
|
|
variables:
|
|
PACKAGE: trytond
|
|
TAG_PATTERN: '/^trytond-.*/'
|
|
|
|
test-trytond-postgresql:
|
|
extends: .test-postgresql
|
|
variables:
|
|
PACKAGE: trytond
|
|
TAG_PATTERN: '/^trytond-.*/'
|
|
|
|
check-doc-trytond-gis:
|
|
extends: .check-doc
|
|
variables:
|
|
PACKAGE: trytond-gis
|
|
|
|
trigger-doc-build-trytond-gis:
|
|
extends: .trigger-doc-build
|
|
variables:
|
|
PACKAGE: trytond-gis
|
|
|
|
test-trytond-gis-postgis:
|
|
extends: .test-postgis
|
|
variables:
|
|
PACKAGE: trytond-gis
|
|
TAG_PATTERN: '/^trytond-gis-.*/'
|
|
|
|
check-doc-proteus:
|
|
extends: .check-doc
|
|
variables:
|
|
PACKAGE: proteus
|
|
|
|
trigger-doc-build-proteus:
|
|
extends: .trigger-doc-build
|
|
variables:
|
|
PACKAGE: proteus
|
|
|
|
test-proteus:
|
|
extends: .test-tox
|
|
variables:
|
|
PACKAGE: proteus
|
|
TAG_PATTERN: '/^proteus-.*/'
|
|
|
|
check-doc-tryton:
|
|
extends: .check-doc
|
|
variables:
|
|
PACKAGE: tryton
|
|
|
|
trigger-doc-build-tryton:
|
|
extends: .trigger-doc-build
|
|
variables:
|
|
PACKAGE: tryton
|
|
|
|
test-tryton:
|
|
extends: .test-tox
|
|
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/tryton/tryton-test:${PYTHON_VERSION}
|
|
variables:
|
|
PACKAGE: tryton
|
|
TAG_PATTERN: '/^tryton-.*/'
|
|
|
|
test-sao:
|
|
extends: .test-npm
|
|
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/tryton/sao-test
|
|
variables:
|
|
PACKAGE: sao
|
|
TAG_PATTERN: '/^sao-.*/'
|
|
|
|
include: '.gitlab-ci-modules.yml'
|