|
|
### Standard `.gitlab-ci.yml` config for Odoo addons
|
|
|
|
|
|
```yml
|
|
|
image: registry.crnd.pro/crnd-opensource/docker/odoo-ci-x:13.0-simple
|
|
|
image: registry.crnd.pro/crnd-opensource/docker/odoo-ci-x:14.0-simple
|
|
|
|
|
|
variables:
|
|
|
SERIES_BRANCH: '13.0'
|
|
|
SERIES_BRANCH: '14.0'
|
|
|
ODOO_ADMIN_PASS: admin
|
|
|
CI_JOB_TOKEN_GIT_HOST: 'gitlab.crnd.pro'
|
|
|
|
|
|
PIP_CACHE_DIR: "${CI_PROJECT_DIR}/.hidden-pip-cache"
|
|
|
|
|
|
.only-stable-branch: &only_stable_branch
|
|
|
only:
|
|
|
- "14.0"
|
|
|
|
|
|
.only-dev-branch: &only_dev_branch
|
|
|
only:
|
|
|
- /^14.0-.*$/
|
|
|
|
|
|
.except-auto-commits: &except_auto_commits
|
|
|
except:
|
|
|
variables:
|
|
|
- $CI_COMMIT_MESSAGE =~ /\[CI-AUTO-UPDATE\]/
|
|
|
- $CI_COMMIT_MESSAGE =~ /Translated using Weblate/
|
|
|
|
|
|
# Disable global cache
|
|
|
cache: {}
|
|
|
|
... | ... | @@ -31,21 +46,26 @@ build_env: |
|
|
- python --version
|
|
|
- odoo-helper --version
|
|
|
- odoo-helper status --tools-versions --ci-tools-versions
|
|
|
- echo "Checking branch compatability $CI_COMMIT_BRANCH" && [[ "$CI_COMMIT_BRANCH" =~ ^14.0(-.*)?$ ]]
|
|
|
|
|
|
flake8:
|
|
|
stage: static-test
|
|
|
script:
|
|
|
- odoo-helper lint flake8 .
|
|
|
<<: *except_auto_commits
|
|
|
|
|
|
pylint:
|
|
|
stage: static-test
|
|
|
script:
|
|
|
- odoo-helper lint pylint "--license_allowed=OPL-1" .
|
|
|
- odoo-helper lint pylint .
|
|
|
<<: *except_auto_commits
|
|
|
|
|
|
stylelint:
|
|
|
stage: static-test
|
|
|
script:
|
|
|
- odoo-helper lint style .
|
|
|
allow_failure: true
|
|
|
<<: *except_auto_commits
|
|
|
|
|
|
bandit:
|
|
|
stage: static-test
|
... | ... | @@ -54,54 +74,54 @@ bandit: |
|
|
- odoo-helper pip install bandit
|
|
|
script:
|
|
|
- odoo-helper exec bandit -r .
|
|
|
<<: *except_auto_commits
|
|
|
|
|
|
check-versions:
|
|
|
stage: static-test
|
|
|
script:
|
|
|
- odoo-helper ci check-versions-git . origin/$SERIES_BRANCH $CI_COMMIT_SHA
|
|
|
only:
|
|
|
- /^13.0-.*$/ # only branches that started with '13.0-'
|
|
|
<<: *only_dev_branch
|
|
|
<<: *except_auto_commits
|
|
|
|
|
|
ensure-changelog:
|
|
|
stage: static-test
|
|
|
script:
|
|
|
- odoo-helper ci ensure-changelog --format md . origin/$SERIES_BRANCH $CI_COMMIT_SHA
|
|
|
only:
|
|
|
- /^13.0-.*$/ # only branches that started with '13.0-'
|
|
|
allow_failure: true
|
|
|
<<: *only_dev_branch
|
|
|
<<: *except_auto_commits
|
|
|
|
|
|
ensure-icons:
|
|
|
stage: static-test
|
|
|
script:
|
|
|
- odoo-helper ci ensure-icons .
|
|
|
only:
|
|
|
- /^13.0-.*$/ # only branches that started with '13.0-'
|
|
|
allow_failure: true
|
|
|
<<: *only_dev_branch
|
|
|
<<: *except_auto_commits
|
|
|
|
|
|
|
|
|
tests:
|
|
|
image: registry.crnd.pro/crnd-opensource/docker/odoo-ci-x:13.0-ci
|
|
|
image: registry.crnd.pro/crnd-opensource/docker/odoo-ci-x:14.0-ci
|
|
|
stage: test
|
|
|
<<: *pip_cache_definition
|
|
|
before_script:
|
|
|
- odoo-helper link .
|
|
|
- apt update -q
|
|
|
- apt install -qy poppler-utils
|
|
|
script:
|
|
|
- odoo-helper --use-unbuffer test --coverage --coverage-report --coverage-skip-covered --create-test-db --dir .
|
|
|
- odoo-helper --use-unbuffer test --coverage --coverage-report --coverage-skip-covered --coverage-fail-under 90 --create-test-db --dir .
|
|
|
<<: *except_auto_commits
|
|
|
coverage: '/^TOTAL\s+\d+\s+\d+\s+(\d+\%)/'
|
|
|
artifacts:
|
|
|
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
|
|
|
when: on_failure
|
|
|
expire_in: 1 day
|
|
|
paths:
|
|
|
- /tmp/odoo_tests/
|
|
|
|
|
|
migration_tests:
|
|
|
image: registry.crnd.pro/crnd-opensource/docker/odoo-ci-x:13.0-ci
|
|
|
image: registry.crnd.pro/crnd-opensource/docker/odoo-ci-x:14.0-ci
|
|
|
stage: test
|
|
|
variables:
|
|
|
ODOO_DB_NAME: test-db
|
|
|
<<: *pip_cache_definition
|
|
|
before_script:
|
|
|
- apt update -q
|
|
|
- apt install -qy poppler-utils
|
|
|
- git checkout $SERIES_BRANCH
|
|
|
- git pull
|
|
|
- odoo-helper link .
|
... | ... | @@ -113,17 +133,11 @@ migration_tests: |
|
|
- odoo-helper --use-unbuffer addons update-list
|
|
|
- odoo-helper --use-unbuffer addons update --db $ODOO_DB_NAME --dir .
|
|
|
script:
|
|
|
- odoo-helper --use-unbuffer test --coverage --coverage-report --coverage-skip-covered --dir .
|
|
|
- odoo-helper --use-unbuffer test --coverage --coverage-report --coverage-skip-covered --coverage-fail-under 90 --dir .
|
|
|
coverage: '/^TOTAL\s+\d+\s+\d+\s+(\d+\%)/'
|
|
|
only:
|
|
|
- /^13.0-.*$/ # only branches that started with '13.0-'
|
|
|
<<: *only_dev_branch
|
|
|
<<: *except_auto_commits
|
|
|
allow_failure: true
|
|
|
artifacts:
|
|
|
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
|
|
|
when: on_failure
|
|
|
expire_in: 1 day
|
|
|
paths:
|
|
|
- /tmp/odoo_tests/
|
|
|
|
|
|
.deploy_review_definition: &deploy_review_definition
|
|
|
stage: deploy
|
... | ... | @@ -132,27 +146,26 @@ migration_tests: |
|
|
script:
|
|
|
- ci-review-app start
|
|
|
tags:
|
|
|
- traefic
|
|
|
- review-apps
|
|
|
- deploy
|
|
|
- odoo-review-ci4-shared
|
|
|
- review-apps
|
|
|
|
|
|
|
|
|
deploy_review_dev:
|
|
|
<<: *deploy_review_definition
|
|
|
environment:
|
|
|
name: review/$CI_COMMIT_REF_NAME
|
|
|
url: http://$CI_ENVIRONMENT_SLUG-$CI_PROJECT_ID.ci3.crnd.pro
|
|
|
url: http://$CI_ENVIRONMENT_SLUG-$CI_PROJECT_ID.ci4.crnd.pro
|
|
|
on_stop: stop_review_dev
|
|
|
only:
|
|
|
- /^13.0-.*$/ # only branches that started with '13.0-'
|
|
|
<<: *only_dev_branch
|
|
|
when: manual
|
|
|
|
|
|
deploy_review_stable:
|
|
|
<<: *deploy_review_definition
|
|
|
environment:
|
|
|
name: stable/$CI_COMMIT_REF_NAME
|
|
|
url: http://$CI_ENVIRONMENT_SLUG-$CI_PROJECT_ID.ci3.crnd.pro
|
|
|
only:
|
|
|
- "13.0"
|
|
|
url: http://$CI_ENVIRONMENT_SLUG-$CI_PROJECT_ID.ci4.crnd.pro
|
|
|
<<: *only_stable_branch
|
|
|
|
|
|
stop_review_dev:
|
|
|
stage: deploy
|
... | ... | @@ -165,9 +178,9 @@ stop_review_dev: |
|
|
- ci-review-app stop
|
|
|
when: manual
|
|
|
tags:
|
|
|
- traefic
|
|
|
- review-apps
|
|
|
- deploy
|
|
|
only:
|
|
|
- /^13.0-.*$/ # only branches that started with '13.0-'
|
|
|
- odoo-review-ci4-shared
|
|
|
- review-apps
|
|
|
<<: *only_dev_branch
|
|
|
|
|
|
``` |
|
|
\ No newline at end of file |