Repository navigation
ci: start build-and-test without waiting for clippy #875
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
Merged
jussielo-amd
merged 2 commits into
ROCm:main
from
jussielo-amd:ci/build-and-test-start-without-clippy
Nov 4, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -5322,6 +5322,134 @@ fi | |
| } | ||
| } | ||
|
|
||
| /// `build-and-test` heads the Linux critical path (build, then the mock E2E | ||
| /// lane that needs it), so it waits for `prek`, the cheap hygiene gate, but not | ||
| /// for `clippy`: the two run in parallel and `clippy` stays a required check of | ||
| /// its own. Putting `clippy` back in `needs:` would silently add its whole | ||
| /// runtime to every run, so the list is pinned exactly. The `clippy` job must | ||
| /// still exist, otherwise dropping it from `needs:` would have dropped the check. | ||
| #[test] | ||
| fn ci_build_and_test_waits_for_prek_but_not_clippy() { | ||
| let ci = read_workflow("ci.yml"); | ||
| let needs = yaml_value_at(&ci_job(&ci, "build-and-test"), 4, "needs") | ||
| .expect("build-and-test declares `needs:`"); | ||
| assert_eq!( | ||
|
Collaborator
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. This pins only build-and-test's own |
||
| flattened_list_items(&needs), | ||
| ["changes", "prek"], | ||
| "build-and-test must need `changes` and `prek` and not `clippy`, which runs \ | ||
| alongside it; a lint failure is still caught by the required `clippy` check" | ||
| ); | ||
| ci_job(&ci, "clippy"); | ||
| } | ||
|
|
||
| /// The other half of the ordering above: with `clippy` no longer ahead of | ||
| /// `build-and-test`, a clippy-red run reaches the E2E job, so what keeps a | ||
| /// failed or skipped build from being read as a pass is the E2E job's own | ||
| /// gate. The job must need `build-and-test`, and every step after the gate step | ||
| /// must follow the gate's decision. What the gate decides is checked by | ||
| /// `ci_e2e_gate_opens_only_once_build_and_test_ran_to_a_verdict`. | ||
| #[test] | ||
| fn ci_e2e_steps_after_the_gate_follow_its_decision() { | ||
| let ci = read_workflow("ci.yml"); | ||
| let e2e = ci_job(&ci, "e2e"); | ||
| let needs = yaml_value_at(&e2e, 4, "needs").expect("e2e declares `needs:`"); | ||
| assert_eq!( | ||
| flattened_list_items(&needs), | ||
| ["changes", "build-and-test"], | ||
| "the e2e job must need `build-and-test`, which it consumes" | ||
| ); | ||
| let steps = job_steps(&e2e).expect("e2e has steps"); | ||
| let gate_at = steps | ||
| .iter() | ||
| .position(|(name, _)| name == "Decide whether to run") | ||
| .expect("e2e has a gate step named `Decide whether to run`"); | ||
| assert!( | ||
| steps.len() > gate_at + 1, | ||
| "the e2e job has steps after its gate" | ||
| ); | ||
| for (name, step) in &steps[gate_at + 1..] { | ||
| assert!( | ||
| step_key(step, "if").contains("steps.gate.outputs.run == 'true'"), | ||
| "the e2e step `{name}` must follow the gate's decision, or a failed \ | ||
| build-and-test would still run it" | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| /// Run the e2e gate's own script, the way GitHub runs a step with no `shell:` | ||
| /// (`bash -e`), over every event and every `build-and-test` result. The gate | ||
| /// opens once `build-and-test` ran to a verdict, `success` or `failure`: it is | ||
| /// a matrix over both images and its result is the aggregate, so a failure on | ||
| /// one image must not skip the other's E2E. A `skipped` or `cancelled` build | ||
| /// never ran to a verdict, so it must not open the work on a push, a pull | ||
| /// request or a merge group; only a manual dispatch, which skips | ||
| /// `build-and-test` on purpose, opens it without one. | ||
| #[cfg(unix)] | ||
| #[test] | ||
| fn ci_e2e_gate_opens_only_once_build_and_test_ran_to_a_verdict() { | ||
| let ci = read_workflow("ci.yml"); | ||
| let steps = job_steps(&ci_job(&ci, "e2e")).expect("e2e has steps"); | ||
| let gate = steps | ||
| .iter() | ||
| .find(|(name, _)| name == "Decide whether to run") | ||
| .expect("e2e has a gate step named `Decide whether to run`"); | ||
| let script = preflight_body_code(&gate.1); | ||
| let run = |event: &str, build: &str, heavy: &str| -> String { | ||
| let script = script | ||
| .replace("${{ github.event_name }}", event) | ||
| .replace("${{ needs.build-and-test.result }}", build) | ||
| .replace("${{ needs.changes.outputs.heavy }}", heavy); | ||
| assert!( | ||
| !script.contains("${{"), | ||
| "the gate reads an expression this test does not substitute: {script}" | ||
| ); | ||
| let dir = tempfile::tempdir().expect("temp dir"); | ||
| let output = dir.path().join("github_output"); | ||
| std::fs::write(&output, "").expect("creating GITHUB_OUTPUT"); | ||
| let out = std::process::Command::new("bash") | ||
| .args(["-e", "-c", &script]) | ||
| .env("GITHUB_OUTPUT", &output) | ||
| .output() | ||
| .expect("running the e2e gate script"); | ||
| assert_eq!( | ||
| exit_code(out.status, "the e2e gate script"), | ||
| 0, | ||
| "the gate script must exit 0 for {event}/{build}/{heavy}" | ||
| ); | ||
| std::fs::read_to_string(&output) | ||
| .expect("reading GITHUB_OUTPUT") | ||
| .trim() | ||
| .to_owned() | ||
| }; | ||
|
|
||
| for event in ["push", "pull_request", "merge_group"] { | ||
| for ran in ["success", "failure"] { | ||
| assert_eq!( | ||
| run(event, ran, "true"), | ||
| "run=true", | ||
| "{event}: a {ran} build-and-test ran to a verdict" | ||
| ); | ||
| assert_eq!( | ||
| run(event, ran, "false"), | ||
| "run=false", | ||
| "{event}: a {ran} build with no heavy change has no E2E work" | ||
| ); | ||
| } | ||
| for bad in ["skipped", "cancelled"] { | ||
| assert_eq!( | ||
| run(event, bad, "true"), | ||
| "run=false", | ||
| "{event}: a {bad} build-and-test never ran to a verdict and must not open the E2E work" | ||
| ); | ||
| } | ||
| } | ||
| // build-and-test is skipped on a dispatch, so the dispatch opens the gate | ||
| // without it; the job-level platform gate decides whether the job runs. | ||
| for build in ["success", "skipped", "failure"] { | ||
| assert_eq!(run("workflow_dispatch", build, ""), "run=true", "{build}"); | ||
| } | ||
| } | ||
|
|
||
| /// Drive the aggregator's script the way GitHub runs a step with no `shell:` | ||
| /// (`bash -e`) over every result a work job can finish with. A skipped | ||
| /// required check counts as passing, so the dangerous outcomes are the ones | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build-and-test no longer waits for clippy. Please confirm
clippyis in the required status checks (and merge queue) in branch protection; the PR body says this was not verified, and the comment above relies on it.