-
Notifications
You must be signed in to change notification settings - Fork 34
/
.gitlab-ci.yml
201 lines (175 loc) · 5.68 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
image: registry.crnd.pro/crnd-opensource/docker/odoo-ci-x:13.0-simple
variables:
SERIES_BRANCH: '13.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:
- "13.0"
.only-dev-branch: &only_dev_branch
only:
- /^13.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: {}
.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
- odoo-helper --version
- odoo-helper status --tools-versions --ci-tools-versions
- odood --version
- echo "Checking branch compatability $CI_COMMIT_BRANCH" && [[ "$CI_COMMIT_BRANCH" =~ ^13.0(-.*)?$ ]]
flake8:
stage: static-test
script:
- odoo-helper lint flake8 .
<<: *except_auto_commits
pylint:
stage: static-test
script:
- 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
<<: *pip_cache_definition
before_script:
- 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_dev_branch
<<: *except_auto_commits
ensure-changelog:
stage: static-test
script:
- odoo-helper ci ensure-changelog --format md . origin/$SERIES_BRANCH $CI_COMMIT_SHA
allow_failure: true
<<: *only_dev_branch
<<: *except_auto_commits
ensure-icons:
stage: static-test
script:
- odoo-helper ci ensure-icons .
allow_failure: true
<<: *only_dev_branch
<<: *except_auto_commits
tests:
image: registry.crnd.pro/crnd-opensource/docker/odoo-ci-x:13.0-ci
stage: test
<<: *pip_cache_definition
before_script:
- odood addons add --single-branch --odoo-requirements=odoo_requirements.txt
- odood addons link -r .
script:
- odood test -t --isw --error-report --coverage --coverage-report --coverage-skip-covered --coverage-fail-under 90 --dir .
<<: *except_auto_commits
coverage: '/^TOTAL\s+\d+\s+\d+\s+(\d+\%)/'
test_installation_no_demo:
image: registry.crnd.pro/crnd-opensource/docker/odoo-ci-x:13.0-ci
stage: test
variables:
ODOO_DB_NAME: test-db-clean
<<: *pip_cache_definition
before_script:
- sudo apt-get update && sudo apt-get install -y libmagic1
# TODO: Use Odood here too
- odoo-helper link .
- odoo-helper db create $ODOO_DB_NAME
script:
- odoo-helper addons install --db "$ODOO_DB_NAME" --dir-r . --show-log-on-error
<<: *except_auto_commits
migration_tests:
image: registry.crnd.pro/crnd-opensource/docker/odoo-ci-x:13.0-ci
stage: test
variables:
ODOO_DB_NAME: test-db
<<: *pip_cache_definition
before_script:
- odood addons add --single-branch --odoo-requirements=odoo_requirements.txt
- odood addons link -f .
script:
- odood test -t --migration --isw --error-report --coverage --coverage-report --coverage-skip-covered --coverage-fail-under=90 --dir .
coverage: '/^TOTAL\s+\d+\s+\d+\s+(\d+\%)/'
<<: *only_dev_branch
<<: *except_auto_commits
allow_failure: true
update_addons_list_and_trans:
image: registry.crnd.pro/crnd-opensource/docker/odoo-ci-x:13.0-ci
stage: deploy
before_script:
- odoo-helper link .
script:
- odoo-helper doc-utils addons-list --installable --sys-name --field name --field license --field version --field summary --field price --format csv . > ./ADDONS.csv
- odoo-helper doc-utils addons-list --installable --sys-name --field name --field license --field version --field summary --field price --format md . > ./ADDONS.md
- odoo-helper tr regenerate --lang-file "uk_UA:uk" --lang-file "ru_RU:ru" --lang-file "de_DE:de" --lang-file "fr_FR:fr" --lang-file "lt_LT:lt" --pot --pot-remove-dates --missing-only --pot-update --dir .
- git add ./ADDONS.csv ./ADDONS.md "*.po" "*.pot"
- odoo-helper ci push-changes "[CI-AUTO-UPDATE]"
<<: *only_stable_branch
<<: *except_auto_commits
allow_failure: true
.deploy_review_definition: &deploy_review_definition
stage: deploy
before_script:
- ci-review-app init
script:
- ci-review-app start
tags:
- 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.ci4.crnd.pro
on_stop: stop_review_dev
auto_stop_in: 1 week
<<: *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.ci4.crnd.pro
<<: *only_stable_branch
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:
- deploy
- odoo-review-ci4-shared
- review-apps
<<: *only_dev_branch