-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
105 lines (93 loc) · 2.8 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
include:
- project: "article714/build-tools"
ref: main
file: "ci/python-job-templates.yml"
variables:
# CI_DEBUG_TRACE: "true"
# Allow to run image with non root user
# FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: 1
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
POSTGRES_DB: testdb
POSTGRES_HOST_AUTH_METHOD: trust
stages:
- quality
- security
- test
- publish
- container-scanning
- cleaning
#-----------------------------------------
# Job Templates
.project_versions:
parallel:
matrix:
- PRODUCT_VERSION: "12.0"
ODOO_CONTAINER_VERSION: "23.1.0"
POSTGRESQL_IMAGE: postgres:11
PYTHON_VERSION: "3.8"
DEBIAN_VERSION: "bullseye"
- PRODUCT_VERSION: "14.0"
ODOO_CONTAINER_VERSION: "23.1.0"
POSTGRESQL_IMAGE: postgres:14
PYTHON_VERSION: "3.9"
DEBIAN_VERSION: "bullseye"
- PRODUCT_VERSION: "15.0"
ODOO_CONTAINER_VERSION: "23.1.0"
POSTGRESQL_IMAGE: postgres:14
PYTHON_VERSION: "3.10"
DEBIAN_VERSION: "bullseye"
- PRODUCT_VERSION: "16.0"
ODOO_CONTAINER_VERSION: "23.1.0"
POSTGRESQL_IMAGE: postgres:14
PYTHON_VERSION: "3.10"
DEBIAN_VERSION: "bullseye"
.test_image:
stage: test
image:
name: ${DOCKER_REGISTRY_HOST}/article714/odoo-container:${PRODUCT_VERSION}-${ODOO_CONTAINER_VERSION}
parallel: !reference [.project_versions, parallel]
.odoo_install:
extends: .test_image
services:
- name: $POSTGRESQL_IMAGE
alias: pgdb
variables:
ODOO_RC: /container/config/odoo/odoo.conf
before_script:
- cp tests/config/odoo.conf /container/config/odoo/odoo.conf
- chpst -u odoo python3 /container/tools/auto_addons_path.py
- chpst -u odoo odoo -d testdb -i base --stop-after-init -c $ODOO_RC
- chpst -u odoo python3 /container/tools/test_db_exists.py
#------------------------------------------
# Quality
linting:
extends: .linting
parallel: !reference [.project_versions, parallel]
script:
- pip install -r ci/requirements.txt
- pylint --rcfile ci/pylint-rc src/odootools
#------------------------------------------
# Tests
test_odoo_script:
extends: .odoo_install
script:
- export PYTHONPATH=${PYTHONPATH}:${PWD}/src
- chpst -u odoo python3 tests/integration/test_odoo_script.py -c $ODOO_RC -e test_extra_param
unit-tests:
stage: test
extends: .test_image
script:
- export PYTHONPATH=${PYTHONPATH}:${PWD}/src
- python3 -m pip install pytest
- pytest --rootdir=tests -c tests/pyunit/pytest.ini
integration-tests:
stage: test
extends: .odoo_install
script:
- python3 -m pip install pytest
- export PYTHONPATH=${PYTHONPATH}:${PWD}/src
- export SVDIR=/container/config/services
- runsvdir -P ${SVDIR} &
- sleep 5
- pytest --rootdir=tests -c tests/integration/pytest.ini