ci: record Cargo-Rail planning evidence - #55
Merged
Merged
Conversation
Add a "Planning evidence" job to the Check workflow. It runs on push to main and on manual dispatch. It records which workspace files the cargo.build work item reads. It saves the record in the Actions cache under the commit that it describes. Both plan jobs now install the stable toolchain, restore the evidence of the base commit, and give it to the planner. A change that no compiler reads, such as a Markdown edit, then skips the jobs that route on cargo.build. A cache miss only widens the plan. Clippy evidence is not recorded. Cargo-Rail 0.30.1 marks it incomplete, because the clippy::cargo lints make clippy-driver run cargo metadata. The evidence binds the Cargo environment. Move RUSTFLAGS from the Check workflow env to the jobs that install mold. The evidence job and both plan jobs then see the same Cargo environment. Remove the since inputs and the full-history fetch from the plan jobs. The v10 Action selects the same comparison by default and fetches the history that it needs. The plan and evidence checkouts do not keep credentials. Narrow the ci work item to the workflows and the Cargo-Rail policy. A new taplo work item routes .taplo.toml to the Format job only. No CI job reads the Makefile, so it routes no work. The extension has no Rust tests, so route on cargo.build in place of cargo.test. Note in the extension manifest that the cdylib has no Rust doctests. Remove three doc examples that could not compile. Each one called a function without the Ruby VM setup that it needs. The prose above each example already says what the example showed.
The planner rejects a missing evidence directory. A cache miss leaves no directory, so the plan job failed. Create the directory before the planner runs. An empty directory only widens the plan.
A manual run has no push or pull-request base. The Action then compares against HEAD~1, which a shallow checkout of a branch does not hold, and the plan job fails. Plan every work item on workflow_dispatch instead.
Cargo-Rail has no complete evidence for cargo.clippy and cargo.doc, so jobs that route on them never skip. Route the Clippy and Documentation jobs on cargo.build. Its evidence covers the same compiler inputs, because the extension has no cfg(doc) or cfg(test) code. Remove the workflow_dispatch trigger from the Check workflow, and record evidence only on push. The Quality planner plans every work item on schedule and manual dispatch, so the Clippy condition reads only the required work. Restore evidence only on push and pull requests, because a scheduled or manual run has no base commit and the key prefix can match an unrelated commit. Give the plan and evidence jobs read-only permissions. Remove the jq step, so that a jq failure cannot skip the cache save. Add rust-cache to the evidence job, because recording works on a warm target directory. Use mold as the default linker in place of job-level RUSTFLAGS. The Cargo configuration already sets target-cpu=x86-64-v3.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Cargo-Rail decides which CI jobs a change needs. Without planning evidence, it cannot prove that a file is outside the Rust build, so it runs the Rust jobs for almost every change. This PR records that evidence on
mainand gives it to the planner. A change that no compiler reads, such as a Markdown edit, then skips the Rust jobs.A new "Planning evidence" job in the Check workflow records which workspace files the
cargo.buildwork item reads. It runs on every push tomainand never on pull requests, so it is never a required check. It usesrust-cache, because recording works on a warm target directory. It saves the record in the Actions cache under the commit that it describes. CI cost: this job compiles the extension once on every push tomain.Both plan jobs now install the stable toolchain, restore the evidence of the base commit on push and pull requests, and pass it to the planner. A cache miss is normal and only widens the plan to the current behavior. Each plan job creates the evidence directory first, because the planner rejects a missing directory but accepts an empty one. The Quality planner plans every work item on its nightly schedule and on manual dispatch, so the Clippy condition reads only the required work.
Cargo-Rail 0.30.1 has no complete evidence for Clippy or rustdoc. It marks Clippy evidence incomplete when the
clippy::cargolints runcargo metadata, and it never records rustdoc. The Clippy and Documentation jobs therefore route oncargo.build. The build evidence covers the same compiler inputs, because the extension has nocfg(doc)orcfg(test)code.The evidence binds the Cargo environment, including
RUSTFLAGS. The Check workflow setRUSTFLAGSfor every job, and the Quality workflow did not. This PR removes thatRUSTFLAGSand makes mold the default linker in the jobs that install it..cargo/config.tomlalready setstarget-cpu=x86-64-v3. The evidence job and both plan jobs then see the same Cargo environment.The plan jobs drop the
sinceinputs and the full-history fetch. The v10 Action selects the same comparison by default and fetches the history that it needs. The plan and evidence jobs have read-only permissions, and their checkouts do not keep credentials.The
ciwork item now holds only the workflows and the Cargo-Rail policy. A newtaplowork item routes.taplo.tomlto the Format job only. No CI job reads theMakefile, so aMakefilechange routes no work.The extension has no Rust tests, so jobs route on
cargo.buildin place ofcargo.test. The extension is acdylib, which cannot run doctests, and a comment in its manifest now says so. This PR also deletes three Rust doc examples in the extension, because they only restated the prose above them.