ci: run the Python suite when .cargo/config.toml or clippy.toml changes - #8985
Open
LuciferYang wants to merge 1 commit into
Open
ci: run the Python suite when .cargo/config.toml or clippy.toml changes#8985LuciferYang wants to merge 1 commit into
LuciferYang wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The two exact path entries close the demonstrated pull-request trigger gap: changes to the root Cargo configuration that reach Python extension builds, and changes to the root Clippy configuration that affect the Python Rust lint job, will now run the Python workflow. Exact-file matching keeps the added runner cost narrowly scoped.
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.
What this changes
.cargo/config.tomlandclippy.tomljoinpython.yml'spull_requestpaths:filter. Two lines, no job changes. Closes #8906.Why the root
.cargo/config.tomlreaches the Python buildsCargo merges configuration up the directory hierarchy, so a build rooted in
python/reads bothpython/.cargo/config.tomland the repository-root file. Measured, because the interesting part is what happens to a key both files set: with[target.aarch64-apple-darwin] rustflags = ["--cfg", "outer_flag"]in a parent.cargo/config.tomland["--cfg", "inner_flag"]in the child's,cargo build -vin the child passes both to rustc. Arrays are joined rather than shadowed, so a root-only edit to eitherrustflagsline changes what the Python extension compiles with even though the sibling sets the same key. On top of that,[profile.release-no-lto]and[profile.bench]are defined only in the root file, so the Python builds take them from there outright.Why
clippy.tomlas wellpython.yml'slintjob runscargo clippywithworking-directory: python, and clippy reads an ancestorclippy.toml. Measured the same way: a crate in a subdirectory of a directory holding aclippy.tomlwith an unknown field fails witherror reading Clippy's configuration file: unknown field. The repository has exactly oneclippy.toml, at the root, and nopython/clippy.toml, so that file is what this job's clippy run uses. Itsdisallowed-macrosentries gate the Rust code behind the Python extension, and editing them currently triggers no Python job.Test plan
yaml.safe_loadparses the file and returns the filter with the two new entries in place.The trigger itself is not exercisable from inside this pull request: proving the new entries match would take a pull request whose only change is one of those two files. What this one does show is the existing behaviour, since it edits
.github/workflows/python.yml, which the filter already lists, so the Python jobs run here.rust.ymlgot the same two entries in #8867.