forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathci_config.py
More file actions
554 lines (545 loc) · 19 KB
/
ci_config.py
File metadata and controls
554 lines (545 loc) · 19 KB
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
#!/usr/bin/env python3
from dataclasses import dataclass
from typing import Callable, Dict, TypeVar
ConfValue = TypeVar("ConfValue", str, bool)
BuildConfig = Dict[str, ConfValue]
CI_CONFIG = {
"build_config": {
"package_release": {
"compiler": "clang-15",
"build_type": "",
"sanitizer": "",
"package_type": "deb",
"static_binary_name": "amd64",
"additional_pkgs": True,
"tidy": "disable",
"with_coverage": False,
},
"coverity": {
"compiler": "clang-15",
"build_type": "",
"sanitizer": "",
"package_type": "coverity",
"tidy": "disable",
"with_coverage": False,
"official": False,
},
"package_aarch64": {
"compiler": "clang-15-aarch64",
"build_type": "",
"sanitizer": "",
"package_type": "deb",
"static_binary_name": "aarch64",
"additional_pkgs": True,
"tidy": "disable",
"with_coverage": False,
},
"package_asan": {
"compiler": "clang-15",
"build_type": "",
"sanitizer": "address",
"package_type": "deb",
"tidy": "disable",
"with_coverage": False,
},
"package_ubsan": {
"compiler": "clang-15",
"build_type": "",
"sanitizer": "undefined",
"package_type": "deb",
"tidy": "disable",
"with_coverage": False,
},
"package_tsan": {
"compiler": "clang-15",
"build_type": "",
"sanitizer": "thread",
"package_type": "deb",
"tidy": "disable",
"with_coverage": False,
},
"package_msan": {
"compiler": "clang-15",
"build_type": "",
"sanitizer": "memory",
"package_type": "deb",
"tidy": "disable",
"with_coverage": False,
},
"package_debug": {
"compiler": "clang-15",
"build_type": "debug",
"sanitizer": "",
"package_type": "deb",
"tidy": "disable",
"with_coverage": False,
},
"binary_release": {
"compiler": "clang-15",
"build_type": "",
"sanitizer": "",
"package_type": "binary",
"tidy": "disable",
"with_coverage": False,
},
"binary_tidy": {
"compiler": "clang-15",
"build_type": "debug",
"sanitizer": "",
"package_type": "binary",
"static_binary_name": "debug-amd64",
"tidy": "enable",
"with_coverage": False,
},
"binary_darwin": {
"compiler": "clang-15-darwin",
"build_type": "",
"sanitizer": "",
"package_type": "binary",
"static_binary_name": "macos",
"tidy": "disable",
"with_coverage": False,
},
"binary_aarch64": {
"compiler": "clang-15-aarch64",
"build_type": "",
"sanitizer": "",
"package_type": "binary",
"tidy": "disable",
"with_coverage": False,
},
"binary_aarch64_v80compat": {
"compiler": "clang-15-aarch64-v80compat",
"build_type": "",
"sanitizer": "",
"package_type": "binary",
"static_binary_name": "aarch64v80compat",
"tidy": "disable",
"with_coverage": False,
},
"binary_freebsd": {
"compiler": "clang-15-freebsd",
"build_type": "",
"sanitizer": "",
"package_type": "binary",
"static_binary_name": "freebsd",
"tidy": "disable",
"with_coverage": False,
},
"binary_darwin_aarch64": {
"compiler": "clang-15-darwin-aarch64",
"build_type": "",
"sanitizer": "",
"package_type": "binary",
"static_binary_name": "macos-aarch64",
"tidy": "disable",
"with_coverage": False,
},
"binary_ppc64le": {
"compiler": "clang-15-ppc64le",
"build_type": "",
"sanitizer": "",
"package_type": "binary",
"static_binary_name": "powerpc64le",
"tidy": "disable",
"with_coverage": False,
},
"binary_amd64_compat": {
"compiler": "clang-15-amd64-compat",
"build_type": "",
"sanitizer": "",
"package_type": "binary",
"static_binary_name": "amd64compat",
"tidy": "disable",
"with_coverage": False,
},
},
"builds_report_config": {
"ClickHouse build check": [
"package_release"
],
"ClickHouse special build check": [
"binary_tidy",
"binary_darwin",
"binary_aarch64",
"binary_aarch64_v80compat",
"binary_freebsd",
"binary_darwin_aarch64",
"binary_ppc64le",
"binary_amd64_compat",
],
},
"tests_config": {
# required_build - build name for artifacts
# force_tests - force success status for tests
"Install packages (amd64)": {
"required_build": "package_release",
},
"Install packages (arm64)": {
"required_build": "package_aarch64",
},
"Stateful tests (asan)": {
"required_build": "package_asan",
},
"Stateful tests (tsan)": {
"required_build": "package_tsan",
},
"Stateful tests (msan)": {
"required_build": "package_msan",
},
"Stateful tests (ubsan)": {
"required_build": "package_ubsan",
},
"Stateful tests (debug)": {
"required_build": "package_debug",
},
"Stateful tests (release)": {
"required_build": "package_release",
},
"Stateful tests (aarch64)": {
"required_build": "package_aarch64",
},
"Stateful tests (release, DatabaseOrdinary)": {
"required_build": "package_release",
},
"Stateful tests (release, DatabaseReplicated)": {
"required_build": "package_release",
},
# Stateful tests for parallel replicas
"Stateful tests (release, ParallelReplicas)": {
"required_build": "package_release",
},
"Stateful tests (debug, ParallelReplicas)": {
"required_build": "package_debug",
},
"Stateful tests (asan, ParallelReplicas)": {
"required_build": "package_asan",
},
"Stateful tests (msan, ParallelReplicas)": {
"required_build": "package_msan",
},
"Stateful tests (ubsan, ParallelReplicas)": {
"required_build": "package_ubsan",
},
"Stateful tests (tsan, ParallelReplicas)": {
"required_build": "package_tsan",
},
# End stateful tests for parallel replicas
"Stateless tests (asan)": {
"required_build": "package_asan",
},
"Stateless tests (tsan)": {
"required_build": "package_tsan",
},
"Stateless tests (msan)": {
"required_build": "package_msan",
},
"Stateless tests (ubsan)": {
"required_build": "package_ubsan",
},
"Stateless tests (debug)": {
"required_build": "package_debug",
},
"Stateless tests (release)": {
"required_build": "package_release",
},
"Stateless tests (aarch64)": {
"required_build": "package_aarch64",
},
"Stateless tests (release, wide parts enabled)": {
"required_build": "package_release",
},
"Stateless tests (release, DatabaseOrdinary)": {
"required_build": "package_release",
},
"Stateless tests (release, DatabaseReplicated)": {
"required_build": "package_release",
},
"Stateless tests (release, s3 storage)": {
"required_build": "package_release",
},
"Stateless tests (debug, s3 storage)": {
"required_build": "package_debug",
},
"Stateless tests (tsan, s3 storage)": {
"required_build": "package_tsan",
},
"Stress test (asan)": {
"required_build": "package_asan",
},
"Stress test (tsan)": {
"required_build": "package_tsan",
},
"Stress test (ubsan)": {
"required_build": "package_ubsan",
},
"Stress test (msan)": {
"required_build": "package_msan",
},
"Stress test (debug)": {
"required_build": "package_debug",
},
"Upgrade check (asan)": {
"required_build": "package_asan",
},
"Upgrade check (tsan)": {
"required_build": "package_tsan",
},
"Upgrade check (msan)": {
"required_build": "package_msan",
},
"Upgrade check (debug)": {
"required_build": "package_debug",
},
"Integration tests (asan)": {
"required_build": "package_asan",
},
"Integration tests (tsan)": {
"required_build": "package_tsan",
},
"Integration tests (release)": {
"required_build": "package_release",
},
"Integration tests (msan)": {
"required_build": "package_msan",
},
"Integration tests flaky check (asan)": {
"required_build": "package_asan",
},
"Compatibility check (amd64)": {
"required_build": "package_release",
},
"Compatibility check (aarch64)": {
"required_build": "package_aarch64",
},
"Unit tests (release-clang)": {
"required_build": "binary_release",
},
"Unit tests (asan)": {
"required_build": "package_asan",
},
"Unit tests (msan)": {
"required_build": "package_msan",
},
"Unit tests (tsan)": {
"required_build": "package_tsan",
},
"Unit tests (ubsan)": {
"required_build": "package_ubsan",
},
"AST fuzzer (debug)": {
"required_build": "package_debug",
},
"AST fuzzer (asan)": {
"required_build": "package_asan",
},
"AST fuzzer (msan)": {
"required_build": "package_msan",
},
"AST fuzzer (tsan)": {
"required_build": "package_tsan",
},
"AST fuzzer (ubsan)": {
"required_build": "package_ubsan",
},
"Stateless tests flaky check (asan)": {
"required_build": "package_asan",
},
"ClickHouse Keeper Jepsen": {
"required_build": "binary_release",
},
"ClickHouse Server Jepsen": {
"required_build": "binary_release",
},
"Performance Comparison": {
"required_build": "package_release",
"test_grep_exclude_filter": "",
},
"Performance Comparison Aarch64": {
"required_build": "package_aarch64",
"test_grep_exclude_filter": "",
},
"SQLancer (release)": {
"required_build": "package_release",
},
"SQLancer (debug)": {
"required_build": "package_debug",
},
"Sign release (actions)": {
"required_build": "package_release"
}
},
} # type: dict
# checks required by Mergeable Check
REQUIRED_CHECKS = [
"Fast test",
"Style Check",
"ClickHouse build check",
"ClickHouse special build check",
"Stateful tests (release)",
"Stateless tests (release)",
"Unit tests (release-clang)",
"Unit tests (asan)",
"Unit tests (msan)",
"Unit tests (tsan)",
"Unit tests (ubsan)",
]
@dataclass
class CheckDescription:
name: str
description: str # the check descriptions, will be put into the status table
match_func: Callable[[str], bool] # the function to check vs the commit status
def __hash__(self) -> int:
return hash(self.name + self.description)
CHECK_DESCRIPTIONS = [
CheckDescription(
"AST fuzzer",
"Runs randomly generated queries to catch program errors. "
"The build type is optionally given in parenthesis. "
"If it fails, ask a maintainer for help",
lambda x: x.startswith("AST fuzzer"),
),
CheckDescription(
"Bugfix validate check",
"Checks that either a new test (functional or integration) or there "
"some changed tests that fail with the binary built on master branch",
lambda x: x == "Bugfix validate check",
),
CheckDescription(
"CI running",
"A meta-check that indicates the running CI. Normally, it's in <b>success</b> or "
"<b>pending</b> state. The failed status indicates some problems with the PR",
lambda x: x == "CI running",
),
CheckDescription(
"ClickHouse build check",
"Builds ClickHouse in various configurations for use in further steps. "
"You have to fix the builds that fail. Build logs often has enough "
"information to fix the error, but you might have to reproduce the failure "
"locally. The <b>cmake</b> options can be found in the build log, grepping for "
'<b>cmake</b>. Use these options and follow the <a href="'
'https://clickhouse.com/docs/en/development/build">general build process</a>',
lambda x: x.startswith("ClickHouse") and x.endswith("build check"),
),
CheckDescription(
"Compatibility check",
"Checks that <b>clickhouse</b> binary runs on distributions with old libc "
"versions. If it fails, ask a maintainer for help",
lambda x: x.startswith("Compatibility check"),
),
CheckDescription(
"Docker image for servers",
"The check to build and optionally push the mentioned image to docker hub",
lambda x: x.startswith("Docker image")
and (x.endswith("building check") or x.endswith("build and push")),
),
CheckDescription(
"Docs Check", "Builds and tests the documentation", lambda x: x == "Docs Check"
),
CheckDescription(
"Fast test",
"Normally this is the first check that is ran for a PR. It builds ClickHouse "
'and runs most of <a href="https://clickhouse.com/docs/en/development/tests'
'#functional-tests">stateless functional tests</a>, '
"omitting some. If it fails, further checks are not started until it is fixed. "
"Look at the report to see which tests fail, then reproduce the failure "
'locally as described <a href="https://clickhouse.com/docs/en/development/'
'tests#functional-test-locally">here</a>',
lambda x: x == "Fast test",
),
CheckDescription(
"Flaky tests",
"Checks if new added or modified tests are flaky by running them repeatedly, "
"in parallel, with more randomization. Functional tests are run 100 times "
"with address sanitizer, and additional randomization of thread scheduling. "
"Integrational tests are run up to 10 times. If at least once a new test has "
"failed, or was too long, this check will be red. We don't allow flaky tests, "
'read <a href="https://clickhouse.com/blog/decorating-a-christmas-tree-with-'
'the-help-of-flaky-tests/">the doc</a>',
lambda x: "tests flaky check" in x,
),
CheckDescription(
"Install packages",
"Checks that the built packages are installable in a clear environment",
lambda x: x.startswith("Install packages ("),
),
CheckDescription(
"Integration tests",
"The integration tests report. In parenthesis the package type is given, "
"and in square brackets are the optional part/total tests",
lambda x: x.startswith("Integration tests ("),
),
CheckDescription(
"Mergeable Check",
"Checks if all other necessary checks are successful",
lambda x: x == "Mergeable Check",
),
CheckDescription(
"Performance Comparison",
"Measure changes in query performance. The performance test report is "
'described in detail <a href="https://github.com/ClickHouse/ClickHouse/tree'
'/master/docker/test/performance-comparison#how-to-read-the-report">here</a>. '
"In square brackets are the optional part/total tests",
lambda x: x.startswith("Performance Comparison"),
),
CheckDescription(
"Push to Dockerhub",
"The check for building and pushing the CI related docker images to docker hub",
lambda x: x.startswith("Push") and "to Dockerhub" in x,
),
CheckDescription(
"Sqllogic",
"Run clickhouse on the "
'<a href="https://www.sqlite.org/sqllogictest">sqllogic</a> '
"test set against sqlite and checks that all statements are passed",
lambda x: x.startswith("Sqllogic test"),
),
CheckDescription(
"SQLancer",
"Fuzzing tests that detect logical bugs with "
'<a href="https://github.com/sqlancer/sqlancer">SQLancer</a> tool',
lambda x: x.startswith("SQLancer"),
),
CheckDescription(
"Stateful tests",
"Runs stateful functional tests for ClickHouse binaries built in various "
"configurations -- release, debug, with sanitizers, etc",
lambda x: x.startswith("Stateful tests ("),
),
CheckDescription(
"Stateless tests",
"Runs stateless functional tests for ClickHouse binaries built in various "
"configurations -- release, debug, with sanitizers, etc",
lambda x: x.startswith("Stateless tests ("),
),
CheckDescription(
"Stress test",
"Runs stateless functional tests concurrently from several clients to detect "
"concurrency-related errors",
lambda x: x.startswith("Stress test ("),
),
CheckDescription(
"Style Check",
"Runs a set of checks to keep the code style clean. If some of tests failed, "
"see the related log from the report",
lambda x: x == "Style Check",
),
CheckDescription(
"Unit tests",
"Runs the unit tests for different release types",
lambda x: x.startswith("Unit tests ("),
),
CheckDescription(
"Upgrade check",
"Runs stress tests on server version from last release and then tries to "
"upgrade it to the version from the PR. It checks if the new server can "
"successfully startup without any errors, crashes or sanitizer asserts",
lambda x: x.startswith("Upgrade check ("),
),
CheckDescription(
"Falback for unknown",
"There's no description for the check yet, please add it to "
"tests/ci/ci_config.py:CHECK_DESCRIPTIONS",
lambda x: True,
),
]