forked from tryton/tryton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
370 lines (335 loc) · 8.69 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
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"
- "doc/**/*"
.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
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip/http-v2
before_script:
- pip install -r "${PACKAGE}/${DOC_DIR}/requirements-doc.txt"
- pip install sphinx-lint rstcheck[sphinx]
script:
- cd "${PACKAGE}"
- python -m sphinx -T -E -W -n -b html -D html_theme_options.navigation_with_keys=False ${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:
extends: .check-doc
variables:
PACKAGE: doc
DOC_DIR: .
rules:
- if: $CI_COMMIT_TAG == null
changes:
- ${PACKAGE}/**/*
when: on_success
- when: never
.check-code:
extends: .check
before_script:
- .gitlab-scripts/doctest2python.py
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-eslint:
extends: .check
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 sao
- npm install --cache ${NODE_CACHE_DIR} --unsafe-perm --legacy-peer-deps
- npm run check
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
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip/http-v2
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/**/*
check-template-modules:
extends: .check
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip/http-v2
before_script:
- pip install cookiecutter
script:
- .gitlab-scripts/check-template-modules.sh
.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-v2
before_script:
- pip install tox
script:
- tox -e "py${PYTHON_VERSION/./}" -c "${PACKAGE}" -- -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", "3.12"]
.test-db:
extends: .test-tox
variables:
DB_CACHE: /tmp/cache
script:
- tox -e "py${PYTHON_VERSION/./}-${DATABASE}" -c "${PACKAGE}" -- -v --output-file junit.xml
.test-sqlite:
extends: .test-db
variables:
DATABASE: sqlite
.test-postgresql:
extends: .test-db
variables:
DATABASE: postgresql
DB_CACHE: 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}" -- -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
check-doc-trytond:
extends: .check-doc
variables:
PACKAGE: trytond
check-trytond-rng:
extends: .check
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip/http-v2
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
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
test-trytond-gis-postgis:
extends: .test-postgis
variables:
PACKAGE: trytond-gis
TAG_PATTERN: '/^trytond-gis-.*/'
check-doc-proteus:
extends: .check-doc
variables:
PACKAGE: proteus
test-proteus:
extends: .test-tox
variables:
PACKAGE: proteus
TAG_PATTERN: '/^proteus-.*/'
check-doc-tryton:
extends: .check-doc
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-.*/'
test-demo:
stage: test
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/python:3.8
variables:
TRYTOND_DATABASE__PATH: /tmp
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip/http-v2
before_script:
- pip install packages/trytond* packages/proteus*
script:
- touch /tmp/demo.sqlite
- echo "admin" > /tmp/password
- TRYTONPASSFILE=/tmp/password trytond-admin --database demo --all --email admin@example.com
- python -m demo --database demo
rules:
- changes:
- demo/**/*
- modules/{account,account_invoice,account_payment,account_statement,company,country,currency,party,product,production,production_routing,production_work,project,purchase,sale,stock,timesheet}/**/*
include: '.gitlab-ci-modules.yml'