forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpull_request.py
More file actions
303 lines (292 loc) · 11.7 KB
/
Copy pathpull_request.py
File metadata and controls
303 lines (292 loc) · 11.7 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
from praktika import Workflow
from ci.defs.defs import (
BASE_BRANCH,
DOCKERS,
SECRETS,
ArtifactConfigs,
JobNames,
)
from ci.defs.job_configs import JobConfigs
from ci.jobs.scripts.workflow_hooks.filter_job import should_skip_job
from ci.jobs.scripts.workflow_hooks.trusted import can_be_tested
# Functional tests with sanitizers are trimmed down in pull requests: instead of
# the full suite, their `selected tests` counterparts run only the tests selected
# for the change. The full suite still runs here in the debug and plain binary
# flavors, the sanitizer builds are still exercised by the stress tests, and the
# master workflow keeps running the full suite in every flavor.
# See ClickHouse/ClickHouse#114725.
SANITIZERS = ("asan_ubsan", "tsan", "msan")
FUNCTIONAL_TESTS_JOBS = [
job
for job in JobConfigs.functional_tests_jobs
if not any(sanitizer in job.name for sanitizer in SANITIZERS)
# All existing Wasm UDF functional tests are `no-msan`, so selected test
# discovery cannot provide a representative WasmEdge smoke test. Keep the
# established full-suite MSan/WasmEdge lanes until that coverage exists.
or "amd_msan, WasmEdge" in job.name
] + JobConfigs.stateless_tests_selected_pr_jobs
ALL_FUNCTIONAL_TESTS = [job.name for job in FUNCTIONAL_TESTS_JOBS]
CORE_BLOCKING_JOB_NAMES = [
job.name
for job in FUNCTIONAL_TESTS_JOBS
if any(
substr in job.name
for substr in (
"_debug, parallel",
"_binary, parallel",
"_binary, sequential",
"_asan_ubsan, distributed plan, parallel",
"_asan_ubsan, db disk, distributed plan, sequential",
"_tsan, parallel",
)
)
] + [
job.name
for job in JobConfigs.integration_test_jobs_required
if "_asan_ubsan, db disk, old analyzer" in job.name
] + [
job.name
for job in JobConfigs.unittest_jobs
]
STYLE_AND_FAST_TESTS = [
JobNames.STYLE_CHECK,
JobNames.FAST_TEST,
*[j.name for j in JobConfigs.tidy_build_arm_jobs],
]
CODE_REVIEW_BLOCKING_JOBS = [
JobNames.STYLE_CHECK,
JobNames.FAST_TEST,
]
REGULAR_BUILD_NAMES = [job.name for job in JobConfigs.build_jobs]
PLAIN_FUNCTIONAL_TEST_JOB = [
j for j in JobConfigs.functional_tests_jobs if "amd_debug, parallel" in j.name
][0]
workflow = Workflow.Config(
name="PR",
event=Workflow.Event.PULL_REQUEST,
base_branches=[BASE_BRANCH],
jobs=[
JobConfigs.style_check,
JobConfigs.code_review.set_run_after(CODE_REVIEW_BLOCKING_JOBS),
JobConfigs.docs_job_mintlify,
JobConfigs.fast_test,
JobConfigs.ci_tests.set_run_after(CORE_BLOCKING_JOB_NAMES),
*JobConfigs.darwin_fast_test_jobs,
*JobConfigs.tidy_build_arm_jobs,
*[job.set_run_after(STYLE_AND_FAST_TESTS) for job in JobConfigs.build_jobs],
*[
job.set_run_after(STYLE_AND_FAST_TESTS)
for job in JobConfigs.extra_validation_build_jobs
],
*[
job.set_run_after(REGULAR_BUILD_NAMES)
for job in JobConfigs.release_build_jobs_with_examples
],
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.special_build_jobs
],
# Gated like the regular builds rather than like the special ones: it is the only job
# that compiles the standalone parser at all, and it needs no build artifact, so there
# is nothing to gain by deferring it behind the functional tests.
*[
job.set_run_after(STYLE_AND_FAST_TESTS)
for job in JobConfigs.wasm_parser_build_jobs
],
*[job.set_run_after(STYLE_AND_FAST_TESTS) for job in JobConfigs.build_llvm_coverage_job],
# TODO: stabilize new jobs and remove set_allow_failure
JobConfigs.lightweight_functional_tests_job,
*[j.set_allow_failure() for j in JobConfigs.stateless_tests_targeted_pr_jobs],
JobConfigs.integration_test_targeted_pr_jobs[0].set_allow_failure(),
JobConfigs.ast_fuzzer_targeted_pr_jobs[0].set_allow_failure(),
JobConfigs.ast_fuzzer_targeted_pr_jobs[1].set_allow_failure(),
*JobConfigs.stateless_tests_flaky_pr_jobs,
# The merge queue's non-sanitizer flaky check also runs here, so a test
# that is only too slow (or only flaky) without a sanitizer is reported
# in the PR rather than first bouncing it from the merge queue. Same job
# config as in `ci/workflows/merge_queue.py`.
*JobConfigs.stateless_tests_flaky_mq_jobs,
*JobConfigs.integration_test_asan_flaky_pr_jobs,
# Per-arch Bugfix Validation Checks (functional + integration tests on
# both amd64 and aarch64). Each per-arch variant has
# `allow_failure=True` so an individual FAIL doesn't block PR merge -
# the aggregate decision (validate iff at least one arch passed) lives
# in the `new_tests_check.py` workflow post-hook below.
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.bugfix_validation_ft_pr_jobs
],
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.bugfix_validation_it_jobs
],
# Unit-test (gtest) bugfix validation: a single AMD-only job (allow_failure)
# that builds a merge-base "before" binary and runs the touched suite against it.
# It is not part of the per-arch FT/IT aggregation; instead new_tests_check.py
# blocks the unit case iff this job reported a definitive FAIL (failed to
# reproduce) — a reproduction or an inconclusive ERROR does not block.
# Like the sibling FT/IT jobs, it is deferred behind the core blocking jobs.
JobConfigs.bugfix_validation_ut_job.set_run_after(CORE_BLOCKING_JOB_NAMES),
*[
j.set_run_after(
CORE_BLOCKING_JOB_NAMES
if j.name not in CORE_BLOCKING_JOB_NAMES
else []
)
for j in FUNCTIONAL_TESTS_JOBS
],
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.functional_tests_jobs_azure
],
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.functional_test_llvm_coverage_jobs
],
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.functional_test_excluded_from_llvm_job
],
*[
job.set_run_after(
CORE_BLOCKING_JOB_NAMES if job.name not in CORE_BLOCKING_JOB_NAMES else []
)
for job in JobConfigs.integration_test_jobs_required[:]
],
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.integration_test_jobs_non_required
],
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.integration_test_llvm_coverage_jobs
],
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.integration_test_excluded_from_llvm_job
],
*JobConfigs.unittest_jobs,
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.unittest_llvm_coverage_job
],
JobConfigs.docker_server.set_run_after(
CORE_BLOCKING_JOB_NAMES
),
JobConfigs.docker_keeper.set_run_after(
CORE_BLOCKING_JOB_NAMES
),
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.install_check_jobs
],
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.compatibility_test_jobs
],
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.stress_test_jobs
],
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.upgrade_test_jobs
],
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.ast_fuzzer_jobs
],
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.buzz_fuzzer_jobs
],
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.performance_comparison_with_master_head_jobs
],
JobConfigs.parser_memory_check_job,
# ClickBench runs on PRs only when files in its digest change
# (see `clickbench_jobs.digest_config`), so the cost is bounded.
*[
job.set_run_after(CORE_BLOCKING_JOB_NAMES)
for job in JobConfigs.clickbench_jobs
],
JobConfigs.llvm_coverage_job,
JobConfigs.promql_compliance_job,
# TODO: stabilize and remove set_allow_failure
JobConfigs.build_profile_diff_job.set_allow_failure(),
JobConfigs.sqllogic_test_master_job.set_run_after(
CORE_BLOCKING_JOB_NAMES
),
JobConfigs.sqlstorm_test_job.set_run_after(
CORE_BLOCKING_JOB_NAMES
),
JobConfigs.docs_examples_job.set_run_after(
CORE_BLOCKING_JOB_NAMES
),
# Keeper stress (PR): 3 no-fault scenarios (prod-mix, read-multi, write-multi),
# default backend only, 15 min each. Runs when src/Coordination or stress test files change.
JobConfigs.keeper_stress_job
.set_name("Keeper Stress Tests (PR)")
.set_timeout(3 * 3600),
*JobConfigs.toolchain_build_jobs,
],
artifacts=[
*ArtifactConfigs.unittests_binaries,
*ArtifactConfigs.clickhouse_binaries,
*ArtifactConfigs.clickhouse_darwin_plain_binaries,
*ArtifactConfigs.clickhouse_debians,
*ArtifactConfigs.clickhouse_rpms,
*ArtifactConfigs.clickhouse_tgzs,
ArtifactConfigs.clickhouse_wasm,
ArtifactConfigs.wasm_parser,
ArtifactConfigs.fuzzers,
ArtifactConfigs.fuzzers_corpus,
ArtifactConfigs.clickhouse_examples,
*ArtifactConfigs.llvm_profdata_file,
ArtifactConfigs.llvm_coverage_info_file,
ArtifactConfigs.toolchain_pgo_bolt_amd,
ArtifactConfigs.toolchain_pgo_bolt_arm,
],
dockers=DOCKERS,
enable_dockers_manifest_merge=True,
secrets=SECRETS,
enable_job_filtering_by_changes=True,
enable_cache=True,
enable_report=True,
enable_cidb=True,
enable_merge_ready_status=True,
enable_gh_summary_comment=True,
enable_commit_status_on_failure=False,
enable_open_issues_check=True,
enable_slack_feed=True,
pre_hooks=[
can_be_tested,
"python3 ./ci/jobs/scripts/workflow_hooks/ci_links.py",
"python3 ./ci/jobs/scripts/workflow_hooks/store_data.py",
"python3 ./ci/jobs/scripts/workflow_hooks/pr_labels_and_category.py",
"python3 ./ci/jobs/scripts/workflow_hooks/version_log.py",
"python3 ./ci/jobs/scripts/workflow_hooks/team_notifications.py",
],
workflow_filter_hooks=[should_skip_job],
post_hooks=[
"python3 ./ci/jobs/scripts/workflow_hooks/pr_body_check.py",
"python3 ./ci/jobs/scripts/workflow_hooks/feature_docs.py",
"python3 ./ci/jobs/scripts/workflow_hooks/new_tests_check.py",
"python3 ./ci/jobs/scripts/workflow_hooks/can_be_merged.py",
"python3 ./ci/jobs/scripts/workflow_hooks/check_report_messages.py",
],
job_aliases={
"integration": JobConfigs.integration_test_jobs_non_required[
0
].name, # plain integration test job, no old analyzer, no dist plan
"fast": "Fast test",
"functional": PLAIN_FUNCTIONAL_TEST_JOB.name,
"build_debug": "Build (amd_debug)",
"build": "Build (amd_binary)",
},
runs_on_label_prefix="pr-",
)
WORKFLOWS = [
workflow,
]