forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#123451 - Kobzol:arbitrary-try-build, r=pietro…
…albini CI: add a script for dynamically computing CI job matrix It would be great if was easier to run specific CI workflows locally, and also to allow us to spawn a specific CI workflow by bors, to enable running arbitrary try builds. See discussion [here](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/CI.20workflows.20refactoring). This PR is a first step in that direction. - Moves the definition of CI runners and (for now) PR jobs into a separate `jobs.yml` file. - Adds a simple Python script that reads the file, decides which jobs should be active for the current CI workflow, and prints them as JSON to their output. - The PR job then reads this output and generates its job matrix based on it. By moving the job definitions from `ci.yml` into a separate file, we can handle it programmatically, which should make it easier to both do local execution of CI jobs and also to do arbitrary try builds.
- Loading branch information
Showing
5 changed files
with
120 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# This file contains definitions of CI job parameters that are loaded | ||
# dynamically in CI from ci.yml. | ||
# You *do not* need to re-run `src/tools/expand-yaml-anchors` when you | ||
# modify this file. | ||
shared_defs: | ||
- &base-job | ||
env: { } | ||
|
||
- &job-linux-4c | ||
os: ubuntu-20.04-4core-16gb | ||
<<: *base-job | ||
|
||
- &job-linux-8c | ||
os: ubuntu-20.04-8core-32gb | ||
<<: *base-job | ||
|
||
- &job-linux-16c | ||
os: ubuntu-20.04-16core-64gb | ||
<<: *base-job | ||
|
||
- &job-macos-xl | ||
os: macos-13 # We use the standard runner for now | ||
<<: *base-job | ||
|
||
- &job-macos-m1 | ||
os: macos-14 | ||
<<: *base-job | ||
|
||
- &job-windows-8c | ||
os: windows-2019-8core-32gb | ||
<<: *base-job | ||
|
||
- &job-windows-16c | ||
os: windows-2019-16core-64gb | ||
<<: *base-job | ||
|
||
- &job-aarch64-linux | ||
os: [ self-hosted, ARM64, linux ] | ||
|
||
pr: | ||
- name: mingw-check | ||
<<: *job-linux-4c | ||
- name: mingw-check-tidy | ||
<<: *job-linux-4c | ||
- name: x86_64-gnu-llvm-17 | ||
env: | ||
ENABLE_GCC_CODEGEN: "1" | ||
<<: *job-linux-16c | ||
- name: x86_64-gnu-tools | ||
<<: *job-linux-16c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python3 | ||
|
||
""" | ||
This script serves for generating a matrix of jobs that should | ||
be executed on CI. | ||
It reads job definitions from `src/ci/github-actions/jobs.yml` | ||
and filters them based on the event that happened on CI. | ||
Currently, it only supports PR builds. | ||
""" | ||
|
||
import json | ||
from pathlib import Path | ||
|
||
import yaml | ||
|
||
JOBS_YAML_PATH = Path(__file__).absolute().parent.parent / "github-actions" / "jobs.yml" | ||
|
||
|
||
if __name__ == "__main__": | ||
with open(JOBS_YAML_PATH) as f: | ||
jobs = yaml.safe_load(f) | ||
job_output = jobs["pr"] | ||
print(f"jobs={json.dumps(job_output)}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters