Run the matrix generator from a cached Swift package build #359
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 283 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.338
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #359"
general
weight: 0.35
FranzBusch
Run the matrix generator from a cached Swift package build
Every generate job compiled
generate-matrix.swiftbefore it could print a matrix, costing ~33s. If we make use of GitHub actions caches to cache the matrix generation binary we can speed this up. This also changes the matrix generation to use a Swift Package which allows for a tidier code structure.Changed:
Moved the generator into the
matrix-generatorpackage as thegenerate-matrixexecutable, with its tests.Added the
generate-matrixcomposite action, which restores the built generator fromactions/cacheand builds it only on a miss.Keyed the cache on the runner, the runner image version (or
swift --versionwhere there is none), and a hash of the package sources.Switched the generate step of
package_test.yml,toolchain_matrix.ymlandbenchmarks.ymlto the action.Moved the benchmark command and environment composition into its own step ahead of the action.
Located the built executable from the tests on both macOS and Linux.
Made the default-agreement test check that a workflow forwards some input, not that emptying the inputs changed it.
Performance:
Measured on GitHub-hosted
ubuntu-26.04runners, one run each, from the first step of the action to the end of its post step.The previous step compiled the script on every run and took about 33 seconds.
A cache miss takes about 36 seconds. Building the generator is 32 of them, and 18 of those are SwiftPM starting up on a runner that has not run Swift yet. Running it takes 2.4, and saving the cache 1.2.
A cache hit takes about 5 seconds. Restoring the generator is 0.8, running it 4.4, and building is skipped.
Naming the toolchain with
swift --versiontook 9.5 and 20.1 seconds on a fresh runner, so a hit spent most of its time producing its key. The image version takes 0.05.A repository pays one miss per change to the generator, and a pull request's first run builds again after it merges, because a cache saved by a pull request is only visible to it.
Result:
A generate job that hits the cache is about 28 seconds faster, and one that misses is about 3 seconds slower.
The generate jobs of one run share the build: a job that saves it is followed by jobs that restore it.