forked from freedomofpress/securedrop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
405 lines (351 loc) · 10.9 KB
/
config.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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
---
common-steps:
- &rebaseontarget
run:
name: Rebase on top of GitHub target branch
command: ./devops/scripts/rebase-ci.sh
- &createcachedir
run:
name: Ensure cache dir exists and permissions are good
command: |
sudo mkdir -p /caches && sudo chown circleci: -R /caches
- &restorecache
restore_cache:
key: v1-sd-layers-{{ checksum "securedrop/dockerfiles/xenial/python2/Dockerfile" }}
paths:
- /caches/layers.tar.gz
- &loadimagelayers
run:
name: Load image layer cache
command: |
set +o pipefail
docker load -i /caches/layers.tar |true
- &dockerimagebuild
run:
name: Build Docker images
command: |
set +o pipefail
docker images
fromtag=$(docker images |grep securedrop-test-xenial-py2 |head -n1 |awk '{print $2}')
cd securedrop && DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-xenial-py2:${fromtag:-latest}" ./bin/dev-shell true
- &saveimagelayers
run:
name: Save Docker image layer cache
command: |
docker images
docker save -o /caches/layers.tar securedrop-test-xenial-py2:latest
- &savecache
save_cache:
key: v1-sd-layers-{{ checksum "securedrop/dockerfiles/xenial/python2/Dockerfile" }}
paths:
- /caches/layers.tar
version: 2
jobs:
lint:
machine:
enabled: true
steps:
- checkout
- *rebaseontarget
- run: make ci-lint
trusty-app-tests:
machine:
enabled: true
environment:
DOCKER_API_VERSION: 1.23
BASE_OS: trusty
parallelism: 3
steps:
- checkout
- *rebaseontarget
- *createcachedir
- restore_cache:
key: v1-sd-layers-{{ checksum "securedrop/dockerfiles/trusty/python2/Dockerfile" }}
paths:
- /caches/layers.tar.gz
- *loadimagelayers
- run:
name: Build Docker image
command: |
set +o pipefail
docker images
fromtag=$(docker images |grep securedrop-test-trusty |head -n1 |awk '{print $2}')
cd securedrop && DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-trusty:${fromtag:-latest}" ./bin/dev-shell true
- run:
name: Save Docker image layer cache
command: |
docker images
docker save -o /caches/layers.tar securedrop-test-trusty:latest
- save_cache:
key: v1-sd-layers-{{ checksum "securedrop/dockerfiles/trusty/python2/Dockerfile" }}
paths:
- /caches/layers.tar
- run:
name: Make test results directory
command: mkdir -p ~/test-results
- run:
name: Run tests
command: |
export TESTFILES=$(cd securedrop; circleci tests glob 'tests/test*py' 'tests/**/test*py' |circleci tests split --split-by=timings |xargs echo)
docker rm -f securedrop-test-trusty || true
fromtag=$(docker images |grep securedrop-test-trusty |head -n1 |awk '{print $2}')
cd securedrop && DOCKER_RUN_ARGUMENTS=$(bash <(curl -s https://codecov.io/env)) DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-trusty:${fromtag:-latest}" make test
- store_test_results:
path: ~/test-results
- store_artifacts:
path: ~/test-results
app-tests:
machine:
enabled: true
environment:
DOCKER_API_VERSION: 1.23
BASE_OS: xenial
parallelism: 3
steps:
- checkout
- *rebaseontarget
- *createcachedir
- *restorecache
- *loadimagelayers
- *dockerimagebuild
- *saveimagelayers
- *savecache
- run:
name: Make test results directory
command: mkdir -p ~/test-results
- run:
name: Run tests
no_output_timeout: 20m
command: |
export TESTFILES=$(cd securedrop; circleci tests glob 'tests/test*py' 'tests/**/test*py' |circleci tests split --split-by=timings |xargs echo)
docker rm -f securedrop-test-xenial-py2 || true
fromtag=$(docker images |grep securedrop-test-xenial-py2 |head -n1 |awk '{print $2}')
cd securedrop && DOCKER_RUN_ARGUMENTS=$(bash <(curl -s https://codecov.io/env)) DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-xenial-py2:${fromtag:-latest}" make test
- store_test_results:
path: ~/test-results
- store_artifacts:
path: ~/test-results
python3-app-tests:
machine:
enabled: true
environment:
DOCKER_API_VERSION: 1.23
BASE_OS: xenial
PYTHON_VERSION: 3
parallelism: 3
steps:
- checkout
- *rebaseontarget
- *createcachedir
- restore_cache:
key: v1-sd-layers-{{ checksum "securedrop/dockerfiles/xenial/python3/Dockerfile" }}
paths:
- /caches/layers.tar.gz
- *loadimagelayers
- run:
name: Build Docker images
command: |
set +o pipefail
docker images
fromtag=$(docker images |grep securedrop-test-xenial-py3 |head -n1 |awk '{print $2}')
cd securedrop && DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-xenial-py3:${fromtag:-latest}" ./bin/dev-shell true
- run:
name: Save Docker image layer cache
command: |
docker images
docker save -o /caches/layers.tar securedrop-test-xenial-py3:latest
- save_cache:
key: v1-sd-layers-{{ checksum "securedrop/dockerfiles/xenial/python3/Dockerfile" }}
paths:
- /caches/layers.tar
- run:
name: Make test results directory
command: mkdir -p ~/test-results
- run:
name: Run tests
command: |
export TESTFILES=$(cd securedrop; circleci tests glob 'tests/test*py' 'tests/**/test*py' |circleci tests split --split-by=timings |xargs echo)
docker rm -f securedrop-test-xenial-py3 || true
fromtag=$(docker images |grep securedrop-test-xenial-py3 |head -n1 |awk '{print $2}')
cd securedrop && DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-xenial-py3:${fromtag:-latest}" make test
- store_test_results:
path: ~/test-results
- store_artifacts:
path: ~/test-results
translation-tests:
machine:
enabled: true
environment:
DOCKER_API_VERSION: 1.23
BASE_OS: xenial
parallelism: 2
steps:
- checkout
- *rebaseontarget
- *createcachedir
- *restorecache
- *loadimagelayers
- *dockerimagebuild
- *saveimagelayers
- *savecache
- run:
name: Make test results directory
command: mkdir -p ~/test-results
- run:
name: Run tests
command: |
export TESTFILES=$(cd securedrop; circleci tests glob 'tests/pageslayout/test*py' |circleci tests split --split-by=timings |xargs echo)
docker rm -f securedrop-test-xenial-py2 || true
fromtag=$(docker images |grep securedrop-test-xenial-py2 |head -n1 |awk '{print $2}')
cd securedrop && DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-xenial-py2:${fromtag:-latest}" make translation-test
- store_test_results:
path: ~/test-results
admin-tests:
docker:
- image: gcr.io/cloud-builders/docker
steps:
- run: apt-get install -y make
- checkout
- setup_remote_docker
- run: cd admin ; make test
fetch-tor-debs:
docker:
- image: gcr.io/cloud-builders/docker
steps:
- run: apt-get install -y make virtualenv python-pip
- checkout
- setup_remote_docker
- run: make fetch-tor-packages
updater-gui-tests:
docker:
- image: circleci/python:3.5
steps:
- checkout
- run:
name: Install libqt5designer5
command: sudo apt-get update && sudo apt-get install -y libqt5designer5
- run:
name: Install pip==18.0 to work pipenv/pip bug
command: |
cd journalist_gui
pipenv run pip install pip==18.0
- run:
name: Install requirements
command: |
cd journalist_gui
pipenv install
- run:
name: Run tests
command: |
cd journalist_gui
xvfb-run -a pipenv run python3 test_gui.py
static-analysis-and-no-known-cves:
machine:
enabled: true
steps:
- checkout
- run:
name: Check Python dependencies for CVEs
command: make safety
- run:
name: Run static security testing on source code
command: make bandit
staging-test-with-rebase:
machine:
enabled: true
working_directory: ~/sd
steps:
- checkout
- *rebaseontarget
- run:
name: Run Staging tests on GCE (Xenial)
command: make ci-go
no_output_timeout: 20m
- run:
name: Ensure environment torn down
# Always report true, since env should will destroyed already
# if all tests passed.
command: make ci-teardown || true
when: always
- store_test_results:
path: ~/sd/junit
- store_artifacts:
path: ~/sd/junit
deb-tests:
docker:
- image: gcr.io/cloud-builders/docker
steps:
- run: apt-get install -y make virtualenv python-pip
- checkout
- setup_remote_docker
- run: make ci-deb-tests
workflows:
version: 2
securedrop_ci:
jobs:
- lint
- app-tests:
filters:
branches:
ignore:
- /docs-.*/
- /i18n-.*/
- python3-app-tests:
filters:
branches:
ignore:
- /docs-.*/
- /i18n-.*/
- admin-tests:
filters:
branches:
ignore:
- /docs-.*/
- /i18n-.*/
- fetch-tor-debs:
filters:
branches:
ignore:
- /docs-.*/
- /i18n-.*/
- updater-gui-tests:
filters:
branches:
ignore:
- /docs-.*/
- /i18n-.*/
- static-analysis-and-no-known-cves:
filters:
branches:
ignore:
- /docs-.*/
- /i18n-.*/
- staging-test-with-rebase:
filters:
branches:
ignore:
- /docs-.*/
- /i18n-.*/
requires:
- lint
- translation-tests:
filters:
branches:
only:
- /i18n-.*/
- deb-tests:
filters:
branches:
only:
- /update-builder-.*/
nightly:
triggers:
- schedule:
cron: "0 4 * * *"
filters:
branches:
only:
- develop
jobs:
- static-analysis-and-no-known-cves
- trusty-app-tests