This repository has been archived by the owner on Nov 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathpipeline.yml
586 lines (545 loc) · 18.5 KB
/
pipeline.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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
# This is just a dummy entry (the `x-yaml-aliases` key is not an official pipeline key, and will be ignored by BuildKite)
# that we use only to store YAML anchors (`&xxx`), that we plan to use and reference later in the YAML file (using `*xxx`)
# without having to copy/paste the same values over and over.
# Note: keys like `agent`, `env`, … used here are totally arbitrary; the only point is to define various separate `&xxx` anchors there.
#
x-yaml-aliases:
commands:
- &trial_setup |
# Install additional packages that are not part of buildpack-deps / python images.
apt-get update && apt-get install -y xmlsec1
python -m pip install tox
retry: &retry_setup
automatic:
- exit_status: -1
limit: 2
- exit_status: 2
limit: 2
env:
COVERALLS_REPO_TOKEN: wsJWOby6j0uCYFiCes3r0XauxO27mx8lD
steps:
- label: "\U0001F9F9 Check Style"
command:
- "python -m pip install tox"
- "tox -e check_codestyle"
branches: "!dinsic !dinsic/*"
plugins:
- docker#v3.7.0:
image: "python:3.6"
mount-buildkite-agent: false
- label: "\U0001F9F9 packaging"
command:
- "python -m pip install tox"
- "tox -e packaging"
plugins:
- docker#v3.7.0:
image: "python:3.6"
mount-buildkite-agent: false
- label: "\U0001F9F9 isort"
command:
- "python -m pip install tox"
- "tox -e check_isort"
plugins:
- docker#v3.7.0:
image: "python:3.6"
mount-buildkite-agent: false
- label: ":newspaper: Newsfile"
if: "build.pull_request.id != null" # Only run this check on pull requests
command:
- "python -m pip install tox"
- "scripts-dev/check-newsfragment"
plugins:
- docker#v3.7.0:
image: "python:3.6"
propagate-environment: true
mount-buildkite-agent: false
- label: "\U0001F9F9 check-sample-config"
command:
- "python -m pip install tox"
- "tox -e check-sampleconfig"
plugins:
- docker#v3.7.0:
image: "python:3.6"
mount-buildkite-agent: false
- label: "\U0001F5A5 check unix line-endings"
command:
- "scripts-dev/check_line_terminators.sh"
plugins:
- docker#v3.7.0:
image: "python:3.6"
mount-buildkite-agent: false
- label: ":mypy: mypy"
command:
- "python -m pip install tox"
- "tox -e mypy"
branches: "!dinsic !dinsic/*"
plugins:
- docker#v3.7.0:
image: "python:3.7"
mount-buildkite-agent: false
- label: ":package: build distribution files"
branches: "release-*"
agents:
queue: ephemeral-small
command:
- python setup.py sdist bdist_wheel
plugins:
- docker#v3.7.0:
image: "python:3.7"
mount-buildkite-agent: false
- artifacts#v1.3.0:
upload:
- dist/*
- wait
################################################################################
#
# Twisted `trial` tests
#
# Our Intent is to test:
# - All supported Python versions (using SQLite) with current dependencies
# - The oldest and newest supported pairings of Python and PostgreSQL
#
# We also test two special cases:
# - The newest supported Python, without any optional dependencies
# - The oldest supported Python, with its oldest supported dependency versions
#
################################################################################
# -- Special Case: Oldest Python w/ Oldest Deps
- label: ":python: 3.6 (Old Deps)"
command:
- ".buildkite/scripts/test_old_deps.sh"
env:
TRIAL_FLAGS: "-j 2"
plugins:
- docker#v3.7.0:
# We use bionic to get an old python (3.6.5) and sqlite (3.22)
image: "ubuntu:bionic"
workdir: "/src"
mount-buildkite-agent: false
propagate-environment: true
- artifacts#v1.3.0:
upload: [ "_trial_temp/*/*.log" ]
retry: *retry_setup
# -- Special Case: Newest Python w/o Optional Deps
- label: ":python: 3.9 (No Extras)"
command:
- *trial_setup
- "tox -e py39-noextras,combine"
env:
TRIAL_FLAGS: "-j 2"
plugins:
- docker#v3.7.0:
image: "python:3.9"
workdir: "/src"
mount-buildkite-agent: false
propagate-environment: true
- artifacts#v1.3.0:
upload: [ "_trial_temp/*/*.log" ]
retry: *retry_setup
# -- All Supported Python Versions (SQLite)
- label: ":python: 3.6"
command:
- *trial_setup
- "tox -e py36,combine"
env:
TRIAL_FLAGS: "-j 2"
plugins:
- docker#v3.7.0:
image: "python:3.6"
workdir: "/src"
mount-buildkite-agent: false
propagate-environment: true
- artifacts#v1.3.0:
upload: [ "_trial_temp/*/*.log" ]
retry: *retry_setup
- label: ":python: 3.7"
command:
- *trial_setup
- "tox -e py37,combine"
env:
TRIAL_FLAGS: "-j 2"
plugins:
- docker#v3.7.0:
image: "python:3.7"
workdir: "/src"
mount-buildkite-agent: false
propagate-environment: true
- artifacts#v1.3.0:
upload: [ "_trial_temp/*/*.log" ]
retry: *retry_setup
- label: ":python: 3.8"
command:
- *trial_setup
- "tox -e py38,combine"
env:
TRIAL_FLAGS: "-j 2"
plugins:
- docker#v3.7.0:
image: "python:3.8"
workdir: "/src"
mount-buildkite-agent: false
propagate-environment: true
- artifacts#v1.3.0:
upload: [ "_trial_temp/*/*.log" ]
retry: *retry_setup
- label: ":python: 3.9"
command:
- *trial_setup
- "tox -e py39,combine"
env:
TRIAL_FLAGS: "-j 2"
plugins:
- docker#v3.7.0:
image: "python:3.9"
workdir: "/src"
mount-buildkite-agent: false
propagate-environment: true
- artifacts#v1.3.0:
upload: [ "_trial_temp/*/*.log" ]
retry: *retry_setup
# -- Oldest and Newest Supported Python and Postgres Pairings
- label: ":python: 3.6 :postgres: 9.6"
agents:
queue: "medium"
env:
TRIAL_FLAGS: "-j 8"
PYTHON_VERSION: "3.6"
POSTGRES_VERSION: "9.6"
command:
- *trial_setup
- "python -m tox -e py36-postgres,combine"
plugins:
- matrix-org/download#v1.1.0:
urls:
- https://raw.githubusercontent.com/matrix-org/pipelines/master/synapse/docker-compose.yaml
- https://raw.githubusercontent.com/matrix-org/pipelines/master/synapse/docker-compose-env
- docker-compose#v3.7.0:
run: testenv
config:
- /tmp/download-${BUILDKITE_BUILD_ID}/docker-compose.yaml
- artifacts#v1.3.0:
upload: [ "_trial_temp/*/*.log" ]
retry: *retry_setup
- label: ":python: 3.9 :postgres: 13"
agents:
queue: "medium"
env:
TRIAL_FLAGS: "-j 8"
PYTHON_VERSION: "3.9"
POSTGRES_VERSION: "13"
command:
- *trial_setup
- "python -m tox -e py39-postgres,combine"
plugins:
- matrix-org/download#v1.1.0:
urls:
- https://raw.githubusercontent.com/matrix-org/pipelines/master/synapse/docker-compose.yaml
- https://raw.githubusercontent.com/matrix-org/pipelines/master/synapse/docker-compose-env
- docker-compose#v3.7.0:
run: testenv
config:
- /tmp/download-${BUILDKITE_BUILD_ID}/docker-compose.yaml
- artifacts#v1.3.0:
upload: [ "_trial_temp/*/*.log" ]
retry: *retry_setup
# -- Experimentally test against PyPy
# Only runs when the build message includes the string "pypy"
# This step is allowed to fail
- label: ":python: PyPy3.6"
if: "build.message =~ /pypy/i || build.branch =~ /pypy/i"
soft_fail: true
command:
# No *trial_setup due to docker-library/pypy#52
- "apt-get update && apt-get install -y xmlsec1"
- "pypy -m pip install tox"
- "tox -e pypy36,combine"
env:
TRIAL_FLAGS: "-j 2"
plugins:
- docker#v3.7.0:
image: "pypy:3.6"
workdir: "/src"
mount-buildkite-agent: false
propagate-environment: true
- artifacts#v1.3.0:
upload: [ "_trial_temp/*/*.log" ]
retry: *retry_setup
################################################################################
#
# Sytest
#
# Our tests have three dimensions:
# 1. Topology (Monolith, Workers, Workers w/ Redis)
# 2. Database (SQLite, PostgreSQL)
# 3. Python Version
#
# Tests can run against either a single or multiple PostgreSQL databases.
# This is configured by setting `MULTI_POSTGRES=1` in the environment.
#
# We mostly care about testing each topology.
# To vary the Python and Postgres versions, we use Docker images which are based
# on an assortment of Linux distributions.
# - "bionic" (Ubuntu 18.04) has Python 3.6 and Postgres 10
# - "buster" (Debian 10) has Python 3.7 and Postgres 11
# - "testing" (Debian 11) (currently) has Python 3.9 and Postgres 13
#
# TODO: this leaves us without sytests for Postgres 9.6. How much do we care
# about that?
#
# Our intent is to test:
# - Monolith:
# - Older Distro + SQLite
# - Older Python + Older PostgreSQL
# - Newer Python + Newer PostgreSQL
# - Workers:
# - Older Python + Older PostgreSQL (MULTI_POSTGRES)
# - Newer Python + Newer PostgreSQL (MULTI_POSTGRES)
# - Workers w/ Redis:
# - Newer Python + Newer PostgreSQL
#
################################################################################
- label: "SyTest Monolith :sqlite::ubuntu: 18.04"
agents:
queue: "medium"
command:
- "bash .buildkite/merge_base_branch.sh"
- "bash /bootstrap.sh synapse"
plugins:
- docker#v3.7.0:
image: "matrixdotorg/sytest-synapse:bionic"
propagate-environment: true
always-pull: true
workdir: "/src"
entrypoint: "/bin/sh"
init: false
shell: ["-x", "-c"]
mount-buildkite-agent: false
volumes: ["./logs:/logs"]
- artifacts#v1.3.0:
upload: [ "logs/**/*.log", "logs/**/*.log.*", "logs/results.tap" ]
- matrix-org/annotate:
path: "logs/annotate.md"
style: "error"
retry: *retry_setup
- label: "SyTest Monolith :postgres::ubuntu: 18.04"
agents:
queue: "medium"
env:
POSTGRES: "1"
command:
- "bash .buildkite/merge_base_branch.sh"
- "bash /bootstrap.sh synapse"
plugins:
- docker#v3.7.0:
image: "matrixdotorg/sytest-synapse:bionic"
propagate-environment: true
always-pull: true
workdir: "/src"
entrypoint: "/bin/sh"
init: false
shell: ["-x", "-c"]
mount-buildkite-agent: false
volumes: ["./logs:/logs"]
- artifacts#v1.3.0:
upload: [ "logs/**/*.log", "logs/**/*.log.*", "logs/results.tap" ]
- matrix-org/annotate:
path: "logs/annotate.md"
style: "error"
retry: *retry_setup
- label: "SyTest Monolith :postgres::debian: testing"
agents:
queue: "medium"
env:
POSTGRES: "1"
command:
- "bash .buildkite/merge_base_branch.sh"
- "bash /bootstrap.sh synapse"
plugins:
- docker#v3.7.0:
image: "matrixdotorg/sytest-synapse:testing"
propagate-environment: true
always-pull: true
workdir: "/src"
entrypoint: "/bin/sh"
init: false
shell: ["-x", "-c"]
mount-buildkite-agent: false
volumes: ["./logs:/logs"]
- artifacts#v1.3.0:
upload: [ "logs/**/*.log", "logs/**/*.log.*", "logs/results.tap" ]
- matrix-org/annotate:
path: "logs/annotate.md"
style: "error"
retry: *retry_setup
- label: "SyTest Workers :postgres::ubuntu: 18.04"
agents:
queue: "xlarge"
env:
MULTI_POSTGRES: "1" # Test with split out databases
POSTGRES: "1"
WORKERS: "1"
BLACKLIST: "synapse-blacklist-with-workers"
command:
- "bash .buildkite/merge_base_branch.sh"
- "bash -c 'cat /src/sytest-blacklist /src/.buildkite/worker-blacklist > /src/synapse-blacklist-with-workers'"
- "bash /bootstrap.sh synapse"
plugins:
- docker#v3.7.0:
image: "matrixdotorg/sytest-synapse:bionic"
propagate-environment: true
always-pull: true
workdir: "/src"
entrypoint: "/bin/sh"
init: false
shell: ["-x", "-c"]
mount-buildkite-agent: false
volumes: ["./logs:/logs"]
- artifacts#v1.3.0:
upload: [ "logs/**/*.log", "logs/**/*.log.*", "logs/results.tap" ]
- matrix-org/annotate:
path: "logs/annotate.md"
style: "error"
retry: *retry_setup
- label: "SyTest Workers :postgres::debian: 10"
agents:
queue: "xlarge"
env:
MULTI_POSTGRES: "1" # Test with split out databases
POSTGRES: "1"
WORKERS: "1"
BLACKLIST: "synapse-blacklist-with-workers"
command:
- "bash .buildkite/merge_base_branch.sh"
- "bash -c 'cat /src/sytest-blacklist /src/.buildkite/worker-blacklist > /src/synapse-blacklist-with-workers'"
- "bash /bootstrap.sh synapse"
plugins:
- docker#v3.7.0:
image: "matrixdotorg/sytest-synapse:buster"
propagate-environment: true
always-pull: true
workdir: "/src"
entrypoint: "/bin/sh"
init: false
shell: ["-x", "-c"]
mount-buildkite-agent: false
volumes: ["./logs:/logs"]
- artifacts#v1.3.0:
upload: [ "logs/**/*.log", "logs/**/*.log.*", "logs/results.tap" ]
- matrix-org/annotate:
path: "logs/annotate.md"
style: "error"
retry: *retry_setup
- label: "SyTest Workers :redis::postgres::debian: 10"
agents:
# this one seems to need a lot of memory.
queue: "xlarge"
env:
POSTGRES: "1"
WORKERS: "1"
REDIS: "1"
BLACKLIST: "synapse-blacklist-with-workers"
command:
- "bash .buildkite/merge_base_branch.sh"
- "bash -c 'cat /src/sytest-blacklist /src/.buildkite/worker-blacklist > /src/synapse-blacklist-with-workers'"
- "bash /bootstrap.sh synapse"
plugins:
- docker#v3.7.0:
image: "matrixdotorg/sytest-synapse:buster"
propagate-environment: true
always-pull: true
workdir: "/src"
entrypoint: "/bin/sh"
init: false
shell: ["-x", "-c"]
mount-buildkite-agent: false
volumes: ["./logs:/logs"]
- artifacts#v1.3.0:
upload: [ "logs/**/*.log", "logs/**/*.log.*", "logs/results.tap" ]
- matrix-org/annotate:
path: "logs/annotate.md"
style: "error"
retry: *retry_setup
################################################################################
#
# synapse_port_db
#
# Tests the oldest and newest supported pairings of Python and PostgreSQL
#
################################################################################
- label: "Port DB :python: 3.6 :postgres: 9.6"
agents:
queue: "medium"
env:
PYTHON_VERSION: "3.6"
POSTGRES_VERSION: "9.6"
command:
- "bash .buildkite/scripts/test_synapse_port_db.sh"
plugins:
- matrix-org/download#v1.1.0:
urls:
- https://raw.githubusercontent.com/matrix-org/pipelines/master/synapse/docker-compose.yaml
- https://raw.githubusercontent.com/matrix-org/pipelines/master/synapse/docker-compose-env
- docker-compose#v3.7.0:
run: testenv
config:
- /tmp/download-${BUILDKITE_BUILD_ID}/docker-compose.yaml
- artifacts#v1.3.0:
upload: [ "_trial_temp/*/*.log" ]
- label: "Port DB :python: 3.9 :postgres: 13"
agents:
queue: "medium"
env:
PYTHON_VERSION: "3.9"
POSTGRES_VERSION: "13"
command:
- "bash .buildkite/scripts/test_synapse_port_db.sh"
plugins:
- matrix-org/download#v1.1.0:
urls:
- https://raw.githubusercontent.com/matrix-org/pipelines/master/synapse/docker-compose.yaml
- https://raw.githubusercontent.com/matrix-org/pipelines/master/synapse/docker-compose-env
- docker-compose#v3.7.0:
run: testenv
config:
- /tmp/download-${BUILDKITE_BUILD_ID}/docker-compose.yaml
- artifacts#v1.3.0:
upload: [ "_trial_temp/*/*.log" ]
# - wait: ~
# continue_on_failure: true
#
# - label: Trigger webhook
# command: "curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d \"payload[build_num]=$BUILDKITE_BUILD_NUMBER&payload[status]=done\""
################################################################################
#
# Complement Test Suite
#
################################################################################
- command:
# Build a docker image from the checked out Synapse source
- "docker build -t matrixdotorg/synapse:latest -f docker/Dockerfile ."
# We want to run against complement from the same named branch or the
# latest version of Complement, so download it here.
- "mkdir -p /complement"
- "(wget -O - https://github.com/matrix-org/complement/archive/$BUILDKITE_BRANCH.tar.gz || wget -O - https://github.com/matrix-org/complement/archive/master.tar.gz) | tar -xz --strip-components=1 -C /complement"
# Build a second docker image on top of the above image. This one sets up Synapse with a generated config file,
# signing and SSL keys so Synapse can run and federate
- "docker build -t complement-synapse -f /complement/dockerfiles/Synapse.Dockerfile /complement/dockerfiles"
# Finally, compile and run the tests.
- "cd /complement"
- "COMPLEMENT_BASE_IMAGE=complement-synapse:latest go test -v -tags synapse_blacklist,msc2946,msc3083 ./tests"
label: "\U0001F9EA Complement"
agents:
queue: "medium"
plugins:
- docker#v3.7.0:
# The dockerfile for this image is at https://github.com/matrix-org/complement/blob/master/dockerfiles/ComplementCIBuildkite.Dockerfile.
image: "matrixdotorg/complement:latest"
mount-buildkite-agent: false
# Complement needs to know if it is running under CI
environment:
- "CI=true"
publish: [ "8448:8448" ]
# Complement uses Docker so pass through the docker socket. This means Complement shares
# the hosts Docker.
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"