-
Notifications
You must be signed in to change notification settings - Fork 119
[CI] Add support for windows to dispatch_job.py #540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
12a2cd6
07ccbcc
246b649
131366d
f2984b4
f4eb5b2
9006477
db15a3f
81cedbb
8bb2afd
e6948e8
a552b04
2e00dcc
ee8ff6c
3767ce5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,50 +17,82 @@ | |
|
|
||
| import kubernetes | ||
|
|
||
| PLATFORM_TO_NAMESPACE = {"Linux": "llvm-premerge-linux-buildbot"} | ||
| PLATFORM_TO_NAMESPACE = { | ||
| "Linux": "llvm-premerge-linux-buildbot", | ||
| "Windows": "llvm-premerge-windows-buildbot", | ||
| } | ||
| LOG_SECONDS_TO_QUERY = 10 | ||
| SECONDS_QUERY_LOGS_EVERY = 5 | ||
|
|
||
|
|
||
| def start_build_linux(commit_sha: str, k8s_client) -> str: | ||
| """Spawns a pod to build/test LLVM at the specified SHA. | ||
| def start_build(k8s_client, pod_name: str, namespace: str, commands: list[str]) -> None: | ||
| """Spawns a pod to run the specified commands. | ||
|
|
||
| Args: | ||
| commit_sha: The commit SHA to build/run the tests at. | ||
| k8s_client: The kubernetes client instance to use for spawning the pod. | ||
|
|
||
| Returns: | ||
| A string containing the name of the pod. | ||
| pod_name: The name of the pod to start. | ||
| namespace: The namespace to launch the pod in. | ||
| commands: The commands to run upon pod start. | ||
| """ | ||
| pod_name = f"build-{commit_sha}" | ||
| commands = [ | ||
| "git clone --depth 100 https://github.com/llvm/llvm-project", | ||
| "cd llvm-project", | ||
| f"git checkout ${commit_sha}", | ||
| "export CC=clang", | ||
| "export CXX=clang++", | ||
| './.ci/monolithic-linux.sh "bolt;clang;clang-tools-extra;flang;libclc;lld;lldb;llvm;mlir;polly" "check-bolt check-clang check-clang-cir check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly" "compiler-rt;libc;libcxx;libcxxabi;libunwind" "check-compiler-rt check-libc" "check-cxx check-cxxabi check-unwind" "OFF"' | ||
| "echo BUILD FINISHED", | ||
| ] | ||
| pod_definition = { | ||
| "apiVersion": "v1", | ||
| "kind": "Pod", | ||
| "metadata": { | ||
| "name": pod_name, | ||
| "namespace": PLATFORM_TO_NAMESPACE["Linux"], | ||
| "namespace": namespace, | ||
| }, | ||
| "spec": { | ||
| "containers": [ | ||
| { | ||
| "name": "build", | ||
| "image": "ghcr.io/llvm/ci-ubuntu-24.04", | ||
| "command": ["/bin/bash", "-c", ";".join(commands)], | ||
| "commands": commands, | ||
| } | ||
| ], | ||
| "restartPolicy": "Never", | ||
| }, | ||
| } | ||
| kubernetes.utils.create_from_dict(k8s_client, pod_definition) | ||
|
|
||
|
|
||
| def start_build_linux(commit_sha: str, k8s_client) -> str: | ||
| """Starts a pod to build/test on Linux at the specified SHA.""" | ||
| pod_name = f"build-{commit_sha}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function comments? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added. I kept them as one liners as these functions should be reasonably self documenting. |
||
| commands = [ | ||
| "git clone --depth 100 https://github.com/llvm/llvm-project", | ||
| "cd llvm-project", | ||
| f"git checkout ${commit_sha}", | ||
| "export CC=clang", | ||
| "export CXX=clang++", | ||
| './.ci/monolithic-linux.sh "bolt;clang;clang-tools-extra;flang;libclc;lld;lldb;llvm;mlir;polly" "check-bolt check-clang check-clang-cir check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly" "compiler-rt;libc;libcxx;libcxxabi;libunwind" "check-compiler-rt check-libc" "check-cxx check-cxxabi check-unwind" "OFF"' | ||
| "echo BUILD FINISHED", | ||
| ] | ||
| start_build( | ||
| k8s_client, | ||
| pod_name, | ||
| PLATFORM_TO_NAMESPACE["Linux"], | ||
| ["/bin/bash", "-c", ";".join(commands)], | ||
| ) | ||
| return pod_name | ||
|
|
||
|
|
||
| def start_build_windows(commit_sha: str, k8s_client): | ||
| """Starts a pod to build/test on Windows at the specified SHA.""" | ||
| pod_name = f"build-{commit_sha}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function comments? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
| bash_commands = [ | ||
| "git clone --depth 100 https://github.com/llvm/llvm-project", | ||
| "cd llvm-project", | ||
| f"git checkout ${commit_sha}", | ||
| '.ci/monolithic-windows.sh "clang;clang-tools-extra;libclc;lld;llvm;mlir;polly" "check-clang check-clang-cir check-clang-tools check-lld check-llvm check-mlir check-polly"', | ||
| "echo BUILD FINISHED", | ||
| ] | ||
| commands = [ | ||
| "call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64", | ||
| "bash", | ||
| "-c", | ||
| ";".join(bash_commands), | ||
| ] | ||
| start_build(k8s_client, pod_name, PLATFORM_TO_NAMESPACE["Windows"], commands) | ||
| return pod_name | ||
|
|
||
|
|
||
|
|
@@ -150,6 +182,8 @@ def main(commit_sha: str, platform: str): | |
| k8s_client = kubernetes.client.ApiClient() | ||
| if platform == "Linux": | ||
| pod_name = start_build_linux(commit_sha, k8s_client) | ||
| elif platform == "Windows": | ||
| pod_name = start_build_windows(commit_sha, k8s_client) | ||
| else: | ||
| raise ValueError("Unrecognized platform.") | ||
| namespace = PLATFORM_TO_NAMESPACE[platform] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.