ClickHouse/ci/workflows/pull_request.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

128 lines
3.3 KiB
Python
Raw Normal View History

2024-09-28 05:46:19 +00:00
from typing import List
2024-10-24 11:17:00 +00:00
from praktika import Artifact, Job, Workflow
from praktika.settings import Settings
from ci.settings.definitions import (
2024-09-28 05:46:19 +00:00
BASE_BRANCH,
DOCKERS,
SECRETS,
JobNames,
RunnerLabels,
)
2024-10-24 11:17:00 +00:00
class ArtifactNames:
2024-10-29 21:09:03 +00:00
CH_AMD_DEBUG = "CH_AMD_DEBUG"
CH_AMD_RELEASE = "CH_AMD_RELEASE"
2024-10-24 11:17:00 +00:00
2024-09-28 05:46:19 +00:00
2024-09-30 11:43:03 +00:00
style_check_job = Job.Config(
2024-09-28 05:46:19 +00:00
name=JobNames.STYLE_CHECK,
runs_on=[RunnerLabels.CI_SERVICES],
2024-10-24 11:17:00 +00:00
command="python3 ./ci/jobs/check_style.py",
2024-09-28 05:46:19 +00:00
run_in_docker="clickhouse/style-test",
)
2024-09-30 18:14:56 +00:00
fast_test_job = Job.Config(
2024-10-01 19:19:35 +00:00
name=JobNames.FAST_TEST,
runs_on=[RunnerLabels.BUILDER],
2024-10-24 11:17:00 +00:00
command="python3 ./ci/jobs/fast_test.py",
2024-09-30 18:14:56 +00:00
run_in_docker="clickhouse/fasttest",
2024-10-24 11:17:00 +00:00
digest_config=Job.CacheDigestConfig(
include_paths=[
"./ci/jobs/fast_test.py",
"./tests/queries/0_stateless/",
"./src",
],
),
)
2024-10-29 21:09:03 +00:00
amd_build_jobs = Job.Config(
name=JobNames.BUILD,
2024-10-24 11:17:00 +00:00
runs_on=[RunnerLabels.BUILDER],
2024-10-29 21:09:03 +00:00
command="python3 ./ci/jobs/build_clickhouse.py",
2024-10-24 11:17:00 +00:00
run_in_docker="clickhouse/fasttest",
digest_config=Job.CacheDigestConfig(
include_paths=[
"./src",
"./contrib/",
"./CMakeLists.txt",
"./PreLoad.cmake",
"./cmake",
"./base",
"./programs",
"./docker/packager/packager",
"./rust",
"./tests/ci/version_helper.py",
],
),
2024-10-29 21:09:03 +00:00
).parametrize(
parameter=["amd_debug", "amd_release"],
provides=[[ArtifactNames.CH_AMD_DEBUG], [ArtifactNames.CH_AMD_RELEASE]],
2024-09-30 18:14:56 +00:00
)
2024-10-29 21:09:03 +00:00
statless_batch_num = 2
stateless_tests_amd_debug_jobs = Job.Config(
2024-10-26 17:35:33 +00:00
name=JobNames.STATELESS_TESTS,
runs_on=[RunnerLabels.BUILDER],
command="python3 ./ci/jobs/functional_stateless_tests.py amd_debug",
2024-10-29 21:09:03 +00:00
run_in_docker="clickhouse/stateless-test",
2024-10-26 17:35:33 +00:00
digest_config=Job.CacheDigestConfig(
include_paths=[
"./ci/jobs/functional_stateless_tests.py",
],
),
2024-10-29 21:09:03 +00:00
requires=[ArtifactNames.CH_AMD_DEBUG],
).parametrize(
parameter=[
f"parallel {i+1}/{statless_batch_num}" for i in range(statless_batch_num)
]
+ ["non-parallel"],
runs_on=[[RunnerLabels.BUILDER] for _ in range(statless_batch_num)]
+ [[RunnerLabels.STYLE_CHECKER]],
2024-10-26 17:35:33 +00:00
)
2024-09-28 05:46:19 +00:00
workflow = Workflow.Config(
name="PR",
event=Workflow.Event.PULL_REQUEST,
base_branches=[BASE_BRANCH],
jobs=[
2024-09-30 11:43:03 +00:00
style_check_job,
2024-09-30 18:14:56 +00:00
fast_test_job,
2024-10-29 21:09:03 +00:00
*amd_build_jobs,
*stateless_tests_amd_debug_jobs,
2024-10-24 11:17:00 +00:00
],
artifacts=[
Artifact.Config(
2024-10-29 21:09:03 +00:00
name=ArtifactNames.CH_AMD_DEBUG,
2024-10-24 11:17:00 +00:00
type=Artifact.Type.S3,
path=f"{Settings.TEMP_DIR}/build/programs/clickhouse",
2024-10-29 21:09:03 +00:00
),
Artifact.Config(
name=ArtifactNames.CH_AMD_RELEASE,
type=Artifact.Type.S3,
path=f"{Settings.TEMP_DIR}/build/programs/clickhouse",
),
2024-09-28 05:46:19 +00:00
],
dockers=DOCKERS,
secrets=SECRETS,
enable_cache=True,
enable_report=True,
enable_merge_ready_status=True,
)
WORKFLOWS = [
workflow,
] # type: List[Workflow.Config]
2024-10-29 21:09:03 +00:00
# if __name__ == "__main__":
# # local job test inside praktika environment
# from praktika.runner import Runner
# from praktika.digest import Digest
#
# print(Digest().calc_job_digest(amd_debug_build_job))
#
# Runner().run(workflow, fast_test_job, docker="fasttest", local_run=True)