|
|
### Standard `.gitlab-ci.yml` config for Odoo addons
|
|
|
|
|
|
```yml
|
|
|
image: registry.crnd.pro/crnd/docker/odoo-ci-x:13.0-simple
|
|
|
|
|
|
variables:
|
|
|
SERIES_BRANCH: '13.0'
|
|
|
ODOO_ADMIN_PASS: admin
|
|
|
|
|
|
PIP_CACHE_DIR: "${CI_PROJECT_DIR}/.hidden-pip-cache"
|
|
|
|
|
|
# Disable global cache
|
|
|
cache: {}
|
|
|
|
|
|
.pip_cache: &pip_cache_definition
|
|
|
cache:
|
|
|
key: ${CI_JOB_NAME}
|
|
|
paths:
|
|
|
- "${PIP_CACHE_DIR}"
|
|
|
|
|
|
stages:
|
|
|
- static-test
|
|
|
- test
|
|
|
- deploy
|
|
|
|
|
|
build_env:
|
|
|
stage: static-test
|
|
|
script:
|
|
|
- pwd
|
|
|
- whoami
|
|
|
- python --version
|
|
|
- odoo-helper --version
|
|
|
- odoo-helper status --tools-versions --ci-tools-versions
|
|
|
|
|
|
flake8:
|
|
|
stage: static-test
|
|
|
script:
|
|
|
- odoo-helper lint flake8 .
|
|
|
|
|
|
pylint:
|
|
|
stage: static-test
|
|
|
script:
|
|
|
- odoo-helper lint pylint "--license_allowed=OPL-1" .
|
|
|
|
|
|
stylelint:
|
|
|
stage: static-test
|
|
|
script:
|
|
|
- odoo-helper lint style .
|
|
|
|
|
|
bandit:
|
|
|
stage: static-test
|
|
|
<<: *pip_cache_definition
|
|
|
before_script:
|
|
|
- odoo-helper pip install bandit
|
|
|
script:
|
|
|
- odoo-helper exec bandit -r .
|
|
|
|
|
|
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-'
|
|
|
|
|
|
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
|
|
|
|
|
|
ensure-icons:
|
|
|
stage: static-test
|
|
|
script:
|
|
|
- odoo-helper ci ensure-icons .
|
|
|
only:
|
|
|
- /^13.0-.*$/ # only branches that started with '13.0-'
|
|
|
allow_failure: true
|
|
|
|
|
|
|
|
|
tests:
|
|
|
image: registry.crnd.pro/crnd/docker/odoo-ci-x:13.0-ci
|
|
|
stage: test
|
|
|
<<: *pip_cache_definition
|
|
|
before_script:
|
|
|
- odoo-helper link .
|
|
|
script:
|
|
|
- odoo-helper --use-unbuffer test --coverage --coverage-report --coverage-skip-covered --create-test-db --dir .
|
|
|
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/docker/odoo-ci-x:13.0-ci
|
|
|
stage: test
|
|
|
variables:
|
|
|
ODOO_DB_NAME: test-db
|
|
|
<<: *pip_cache_definition
|
|
|
before_script:
|
|
|
- git checkout $SERIES_BRANCH
|
|
|
- git pull
|
|
|
- odoo-helper link .
|
|
|
- odoo-helper --use-unbuffer db create --demo $ODOO_DB_NAME
|
|
|
- odoo-helper --use-unbuffer addons install --db $ODOO_DB_NAME --dir .
|
|
|
- git checkout $CI_COMMIT_SHA
|
|
|
- git clean -fdx
|
|
|
- odoo-helper link .
|
|
|
- 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 .
|
|
|
coverage: '/^TOTAL\s+\d+\s+\d+\s+(\d+\%)/'
|
|
|
only:
|
|
|
- /^13.0-.*$/ # only branches that started with '13.0-'
|
|
|
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
|
|
|
before_script:
|
|
|
- ci-review-app init
|
|
|
script:
|
|
|
- ci-review-app start
|
|
|
tags:
|
|
|
- traefic
|
|
|
- review-apps
|
|
|
- deploy
|
|
|
|
|
|
deploy_review_dev:
|
|
|
<<: *deploy_review_definition
|
|
|
environment:
|
|
|
name: review/$CI_COMMIT_REF_NAME
|
|
|
url: http://$CI_ENVIRONMENT_SLUG-$CI_PROJECT_ID.ci3.crnd.pro
|
|
|
on_stop: stop_review_dev
|
|
|
only:
|
|
|
- /^13.0-.*$/ # only branches that started with '13.0-'
|
|
|
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"
|
|
|
|
|
|
stop_review_dev:
|
|
|
stage: deploy
|
|
|
environment:
|
|
|
name: review/$CI_COMMIT_REF_NAME
|
|
|
action: stop
|
|
|
variables:
|
|
|
GIT_STRATEGY: none
|
|
|
script:
|
|
|
- ci-review-app stop
|
|
|
when: manual
|
|
|
tags:
|
|
|
- traefic
|
|
|
- review-apps
|
|
|
- deploy
|
|
|
only:
|
|
|
- /^13.0-.*$/ # only branches that started with '13.0-'
|
|
|
``` |
|
|
\ No newline at end of file |