-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
286 lines (280 loc) · 7.39 KB
/
.drone.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
kind: pipeline
type: docker
name: default
workspace:
base: /cdedb2
path: .
clone:
disable: true
steps:
- name: clone
image: docker:20.10-git
commands:
- git clone $DRONE_GIT_HTTP_URL .
# make use of our custom po file merge driver
- apk add --no-cache gettext
- |
echo '''[merge "pomerge"]
name = Gettext merge driver
driver = i18n/git-merge-po.sh %O %A %B
''' >> ./.git/config
- git fetch origin $DRONE_TARGET_BRANCH
- git checkout $DRONE_TARGET_BRANCH
- git fetch origin $DRONE_COMMIT
- git merge $DRONE_COMMIT || (git merge --abort && git checkout $DRONE_COMMIT)
- git tag --force --message "Git state upon which all ci steps work." ci/workdir
- name: build images
image: docker:20.10
volumes:
- name: dockersock
path: /var/run/docker.sock
depends_on:
- clone
commands:
# we do not tag a version as this would create many images
# which would not be cleared from docker cache
- docker build --file related/docker/Dockerfile-postgres --tag cdepostgres .
- docker build --file related/docker/Dockerfile-cdedb --tag cdedb .
- docker build --file related/docker/Dockerfile-ldaptor --tag ldaptor .
- name: cdb # is used as the hostname for the container
image: cdepostgres
pull: never # do not try to pull image from docker hub
detach: true # detach to keep running for the following steps
environment:
POSTGRES_PASSWORD: passwd
volumes:
- name: database
path: /var/lib/postgresql/data
depends_on:
- build images
- name: evolution-trial
image: cdedb
pull: never # do not try to pull image from docker hub
depends_on:
- cdb
environment:
CDEDB_CONFIGPATH: tests/config/test_1.py
POSTGRES_PASSWORD: passwd
commands:
- make i18n-compile # needed for sample-data creation in evolution-trial.sh
- python3 -m cdedb filesystem log create # TODO needed during dependencies of script.py
- sleep 3 # wait for posgres container to start up
- pg_isready --host=cdb --timeout=15 # wait for database to come online
- python3 -m cdedb db create-users # basic setup of the database for all following tests
- bin/evolution-trial.sh origin/$DRONE_TARGET_BRANCH ci/workdir || (git checkout ci/workdir && exit 1)
- git checkout ci/workdir
- name: mypy
image: cdedb
pull: never # do not try to pull image from docker hub
depends_on:
- evolution-trial # wait for all git operations to be done
when:
status:
- failure
- success
commands:
- make mypy
- name: lint
image: cdedb
pull: never # do not try to pull image from docker hub
depends_on:
- evolution-trial # wait for all git operations to be done
when:
status:
- failure
- success
commands:
- make --keep-going lint
- name: testsuite-setup
image: cdedb
pull: never # do not try to pull image from docker hub
depends_on:
- evolution-trial # wait for all git operations to be done
when:
status:
- failure
- success
environment:
CDEDB_CONFIGPATH: tests/config/test_ldap.py
commands:
- make i18n-compile # required for sample-data target
- pg_isready --host=cdb --timeout=15 # wait for database to come online
- python3 -m cdedb filesystem log create
- python3 -m cdedb db create # create the test database for ldap ...
- python3 -m cdedb dev compile-sample-data-sql --outfile - > tests/ancillary_files/sample_data.sql
- python3 -m cdedb db populate # ... and populates it
- name: ldap # is used as the hostname for the container
image: ldaptor
pull: never # do not try to pull image from docker hub
detach: true # detach to keep running for the following steps
depends_on:
- testsuite-setup
when:
status:
- failure
- success
volumes:
- name: ldap
path: /etc/ssl/ldap
environment:
CDEDB_CONFIGPATH: tests/config/test_ldap.py
- name: frontend tests a-d
image: cdedb
pull: never # do not try to pull image from docker hub
depends_on:
- testsuite-setup
when:
status:
- failure
- success
volumes:
- name: tmp_dir
path: /tmp
- name: coverage
path: /coverage
commands:
- COVERAGE_FILE=/coverage/.coverage.1 python3 -m coverage run -p bin/check.py --verbose --first # everything before event
- name: frontend tests e-z
image: cdedb
pull: never # do not try to pull image from docker hub
depends_on:
- testsuite-setup
when:
status:
- failure
- success
volumes:
- name: tmp_dir
path: /tmp
- name: coverage
path: /coverage
commands:
- COVERAGE_FILE=/coverage/.coverage.2 python3 -m coverage run -p bin/check.py --verbose --second # event and following
- name: non-frontend tests
image: cdedb
pull: never # do not try to pull image from docker hub
depends_on:
- testsuite-setup
when:
status:
- failure
- success
volumes:
- name: tmp_dir
path: /tmp
- name: coverage
path: /coverage
commands:
- COVERAGE_FILE=/coverage/.coverage.3 python3 -m coverage run -p bin/check.py --verbose --third
- name: ldap tests
image: cdedb
pull: never # do not try to pull image from docker hub
depends_on:
- testsuite-setup
- ldap
when:
status:
- failure
- success
volumes:
- name: ldap
path: /etc/ssl/ldap
- name: tmp_dir
path: /tmp
- name: coverage
path: /coverage
commands:
- sleep 10 # wait until the ldap server comes online
- COVERAGE_FILE=/coverage/.coverage.4 python3 -m coverage run -p bin/check.py --verbose --all-ldap
- name: coverage
image: cdedb
pull: never
depends_on:
- frontend tests a-d
- frontend tests e-z
- non-frontend tests
- ldap tests
when:
status:
- failure
- success
volumes:
- name: coverage
path: /coverage
commands:
- python3 -m coverage combine /coverage/
# Show coverage first, ...
- python3 -m coverage report --include 'cdedb/*' --show-missing
- python3 -m coverage report --include 'tests/common.py' --show-missing
- python3 -m coverage report --include 'tests/*/*.py' --show-missing
# temporary:
- python3 -m coverage report --include 'cdedb/models/event_constraint_violations.py' --show-missing
# ... fail-under later.
- python3 -m coverage report --include 'cdedb/*' --fail-under=92
- python3 -m coverage report --include 'tests/*/*.py' --fail-under=100
- name: xss
image: cdedb
pull: never
depends_on:
- testsuite-setup
when:
status:
- failure
- success
volumes:
- name: tmp_dir
path: /tmp
commands:
- bin/check.py --verbose --parts xss
- name: check sample data consistency
image: cdedb
pull: never
depends_on:
- ldap tests
when:
status:
- failure
- success
volumes:
- name: tmp_dir
path: /tmp
environment:
CDEDB_CONFIGPATH: tests/config/test_ldap.py
commands:
- python3 -m cdedb dev check-sample-data-consistency
- name: check for merge conflicts
image: docker:20.10-git
pull: never # do not try to pull image from docker hub
depends_on:
- frontend tests a-d
- frontend tests e-z
- non-frontend tests
- ldap tests
- xss
when:
status:
- failure
- success
commands:
# let the pipeline fail if merge caused conflicts
- apk add --no-cache gettext
- git checkout $DRONE_TARGET_BRANCH
- git merge $DRONE_COMMIT
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
- name: database
temp:
medium: memory
- name: ldap
temp: {}
- name: tmp_dir
temp: {}
- name: coverage
temp: {}
trigger:
branch:
- master
- stable
- ci/*