Commit a73900f
authored
ci: select affected crates for Rust tests (#70)
* xtask: add affected-crate selector for CI test selection
Within the Rust CI jobs a one-line change in a single leaf crate still
rebuilds and re-tests the whole 15-member workspace. Add `cargo xtask
affected`, which maps changed files (over a `base...HEAD` range) to their
owning crate via `cargo metadata`, expands through the reverse-dependency
graph, and prints the result as cargo package-selection flags.
Selection is conservative: any change that can't be confined to specific
crates (Cargo.lock, the toolchain file, the workspace root manifest, CI
config, or any unrecognized path) falls back to `--workspace`, so a test
that should run is never skipped. Docs-only changes select nothing. A
workspace member at the repository root is rejected, since it would own
every file and defeat that fallback.
Reuses cargo metadata and serde_json (already deps); no new third-party
dependency. The pure decision logic is unit-tested without git or cargo.
Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
* ci: run affected-only tests via a dedicated nextest job
Split unit/integration tests out of build-and-test into a `test` job that
runs `cargo nextest run` over only the crates a change can reach — the
output of `cargo xtask affected` (changed crates + transitive dependents)
— instead of the whole workspace.
build-and-test keeps building the runtime binaries its smoke/acceptance
steps need (those hard-fail on a missing engine binary), so the test
narrowing can't starve them; clippy --all-targets remains the compile
check for non-binary targets.
Merge-queue safe: narrowing is applied only on pull_request. On push and
in the merge queue the selection is forced to --workspace, so main and
queued PRs always run the full suite and no required check is starved. The
full Windows suite runs the whole workspace on every change, backstopping
any crate a graph-based selection could miss. PR and push builds use
separate cache lanes so the differing feature resolutions don't thrash.
Third-party actions added here are pinned to commit SHAs. docs/testing.md
documents the new command.
Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
---------
Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>1 parent fc2902d commit a73900f
4 files changed
Lines changed: 599 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
121 | 126 | | |
122 | 127 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 128 | + | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| |||
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
153 | 224 | | |
154 | 225 | | |
155 | 226 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
37 | 54 | | |
38 | 55 | | |
39 | 56 | | |
| |||
0 commit comments