Commit ab6379f
Cache uv and Go binaries in CI workflows (#224)
## Summary
Optimize CI performance by caching the `uv` package manager and Go-built
gate binaries (`actionlint`, `gitleaks`) across workflow runs, reducing
redundant downloads and compilation.
## Key Changes
- **Replace manual `uv` installation with `astral-sh/setup-uv` action**
across three jobs (`ci`, `test-e2e`, `docs-snapshot`):
- Uses the official setup action (v8.2.0) with caching enabled
- Caches the uv download cache (`~/.cache/uv`) keyed on `uv.lock`,
avoiding re-downloads of locked dependencies including Rust-backed
sdists (pydantic-core, jiter, cryptography)
- Simplifies the install step from `python -m pip install uv` to a
declarative action
- **Add caching for Go gate binaries** in the `ci` job:
- New `actions/cache` step caches `~/go/bin` keyed on
`scripts/gate_tool_pins.sh`
- Conditional `go install` only runs on cache miss, skipping from-source
compilation when binaries are cached
- Uses environment variable to safely pass cache-hit output to the
script (avoiding template-injection risk)
- **Separate `uv sync --frozen` into its own step** in the
`docs-snapshot` job for clarity
## Implementation Details
- All cache keys are deterministic and tied to their respective lock/pin
files, ensuring cache invalidation when dependencies change
- The Go binary caching uses a conditional check (`if [ "$CACHE_HIT" !=
"true" ]`) to skip compilation entirely on cache hits
- Cache-hit output is mapped to an environment variable rather than
expanded directly in the script, following security best practices
(zizmor template-injection rule)
https://claude.ai/code/session_01Wboq6L5ujSodPxqbewP3tx
Co-authored-by: Claude <noreply@anthropic.com>1 parent b468637 commit ab6379f
1 file changed
Lines changed: 38 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
74 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
75 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
76 | 93 | | |
77 | 94 | | |
78 | | - | |
79 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
80 | 99 | | |
81 | 100 | | |
82 | 101 | | |
| |||
155 | 174 | | |
156 | 175 | | |
157 | 176 | | |
158 | | - | |
159 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
160 | 182 | | |
161 | 183 | | |
162 | 184 | | |
| |||
225 | 247 | | |
226 | 248 | | |
227 | 249 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
232 | 257 | | |
233 | 258 | | |
234 | 259 | | |
| |||
0 commit comments