forked from vstconsulting/polemarch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
227 lines (203 loc) · 4.83 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
# set to local images because too long execution
image: onegreyonewhite/tox:tox
variables:
TESTS: "polemarch.main.tests"
GET_SOURCES_ATTEMPTS: 3
ARTIFACT_DOWNLOAD_ATTEMPTS: 3
RESTORE_CACHE_ATTEMPTS: 3
stages:
- code_standarts
- build
- test
- packaging-test
- release
.branch_tests_template: &branch_tests
stage: test
image: git.vst.lan/vst/tests:tox
variables:
TOX_ENVS: ""
script:
- make test ENVS=$TOX_ENVS
- make build-clean
- coverage html
artifacts:
name: "coverage_branch(${CI_BUILD_REF_NAME})_${CI_BUILD_ID}"
expire_in: 1 hour
paths:
- htmlcov/
- dist/
except:
- master
- GUI
- tags
retry: 2
.pack_tamplate: &packing-test
stage: packaging-test
image: git.vst.lan/vst/tests:tox
variables:
MYSQL_ROOT_PASSWORD: 'polemarch'
MYSQL_DATABASE: 'polemarch'
MYSQL_USER: 'polemarch'
MYSQL_PASSWORD: 'polemarch'
RABBITMQ_DEFAULT_USER: 'polemarch'
RABBITMQ_DEFAULT_PASS: 'polemarch'
RABBITMQ_DEFAULT_VHOST: 'polemarch'
services:
- name: 'mysql:latest'
alias: 'db-server'
- name: 'memcached'
alias: 'cache-server'
- name: 'memcached'
alias: 'locks-server'
- name: 'rabbitmq:latest'
alias: 'rabbitmq-server'
artifacts:
name: "package($CI_BUILD_NAME)"
expire_in: 1 hour
paths:
- dist/
allow_failure: false
only:
# - /^issue_.*$/
- developer
# - master
- make_bin_packages
retry: 2
.tests_template: &tests_template
stage: test
only:
- master
script:
- make test ENVS=$CI_BUILD_NAME-install
dependencies:
- build_zip
retry: 2
# Branch tests
###########################################
code_style:
stage: code_standarts
image: git.vst.lan/vst/tests:tox
script:
- make test ENVS=flake,pylint
cache:
paths:
- .tox/pylint
- .tox/flake
only:
- /^.{0,}issue_.*$/
- developer
retry: 2
py27-django111-coverage:
<<: *branch_tests
variables:
TOX_ENVS: "$CI_BUILD_NAME"
py36-django111-coverage:
<<: *branch_tests
variables:
TOX_ENVS: "$CI_BUILD_NAME"
default_rpm_tests:
<<: *packing-test
script:
- cat /etc/hosts
- make rpm RELEASE=${CI_BUILD_ID}
- sudo yum install dist/*.rpm -y -q
- sudo cat test_settings.ini > /etc/polemarch/settings.ini
- sudo chown polemarch:polemarch /etc/polemarch/settings.ini
- sudo -H -u polemarch /opt/polemarch/bin/pip install -r requirements-test.txt
- sudo -H -u polemarch /opt/polemarch/bin/polemarchctl test -v2 polemarch.main.tests
default_oracle_tests:
<<: *packing-test
image: git.vst.lan/vst/tests:oracle
script:
- cat /etc/hosts
- make rpm RELEASE=${CI_BUILD_ID}
- sudo yum install dist/*.rpm -y -q
- sudo cat test_settings.ini > /etc/polemarch/settings.ini
- sudo chown polemarch:polemarch /etc/polemarch/settings.ini
- sudo -H -u polemarch /opt/polemarch/bin/pip install -r requirements-test.txt
- sudo -H -u polemarch /opt/polemarch/bin/polemarchctl test -v2 polemarch.main.tests
default_deb_tests:
<<: *packing-test
image: git.vst.lan/vst/tests:ubuntu
script:
- cat /etc/hosts
- make deb RELEASE=${CI_BUILD_ID}
- echo "echo 'hello'" > /bin/systemctl
- sudo apt install ./dist/*.deb -y -q
- sudo cat test_settings.ini > /etc/polemarch/settings.ini
- sudo chown polemarch:polemarch /etc/polemarch/settings.ini
- sudo -H -u polemarch /opt/polemarch/bin/pip install -r requirements-test.txt
- sudo -H -u polemarch /opt/polemarch/bin/polemarchctl test -v2 polemarch.main.tests
# Master tests
###########################################
build_zip:
stage: build
only:
- master
script:
- make rpm RELEASE=${CI_BUILD_ID}
artifacts:
expire_in: 30 minutes
paths:
- dist/
retry: 2
py27-django111:
<<: *tests_template
py35-django111:
<<: *tests_template
py36-django111:
<<: *tests_template
pep8_checks:
stage: code_standarts
only:
- master
script:
- make test ENVS=flake
allow_failure: false
retry: 2
pylint_checks:
stage: code_standarts
only:
- master
script:
- make test ENVS=pylint
allow_failure: false
retry: 2
# Realese
###########################################
release_rpm:
stage: release
only:
- tags
script:
- make rpm
allow_failure: false
artifacts:
name: "release-rpm-${CI_BUILD_REF_NAME}.${CI_BUILD_ID}"
paths:
- dist/
release_deb:
stage: release
only:
- tags
image: git.vst.lan/vst/tests:ubuntu
script:
- make deb
allow_failure: false
artifacts:
name: "release-rpm-${CI_BUILD_REF_NAME}.${CI_BUILD_ID}"
paths:
- dist/
release_pypi:
stage: release
only:
- tags
script:
- python2 setup.py compile
- twine upload -u ${PYPI_UPLOAD_NAME} -p ${PYPI_UPLOAD_PASSWORD} dist/*.tar.gz
allow_failure: true
when: manual
artifacts:
name: "release-rpm-${CI_BUILD_REF_NAME}.${CI_BUILD_ID}"
paths:
- dist/