name: "Cache the Rust build" description: >- Cache the Cargo registry and target directory the root package's build needs, so only the first job on a given Cargo.lock compiles the bridge from scratch. litellm builds through maturin, which compiles litellm-rust/crates/python-bridge in release mode before it can produce a wheel. `uv sync` therefore pays a full build in every job that installs the workspace: measured at 2m40s per unit shard on 2026-08-21, more than the whole unit tier spends running tests. Nothing caught it, because the uv cache holds wheels uv downloads rather than wheels it builds, and a path dependency whose source moves every commit could never hit that cache anyway. Cargo rebuilds only what changed when its target directory survives, so a warm job pays for the bridge crate alone. The key namespace is separate from test-rust.yml's. Both cache the same directory, but that workflow fills it with debug and clippy artifacts, which a release build cannot reuse, and a shared key would let whichever ran first deny the other a save. runs: using: composite steps: - name: Restore the Cargo registry and target directory uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: | ~/.cargo/registry ~/.cargo/git litellm-rust/target key: ${{ runner.os }}-cargo-release-${{ hashFiles('litellm-rust/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo-release-