Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

ci(tend-setup): restore the shared rust cache instead of dropping it (#3846)

Worktrunk Bota06102fdd552
diff --git a/.github/CLAUDE.md b/.github/CLAUDE.md
index 778690e5d..a20c441ac 100644
--- a/.github/CLAUDE.md
+++ b/.github/CLAUDE.md
@@ -84,3 +84,10 @@ running in that same `release` environment.
`Swatinem/rust-cache` hashes `CARGO*` and `RUST*` env vars into the cache key.
All workflows sharing a cache must set the same env vars, or they'll get
different keys and miss each other's caches.
+
+It hashes the vars **visible at its own step**, so a var exported by a later
+step is invisible and a var the writers don't set poisons the key. ci.yaml and
+nightly.yaml carry theirs in a workflow-level `env:` block, always in place
+first; the generated `tend-*.yaml` files can't, so `tend-setup` sets the same
+three vars in a step above its cache step. A miss is silent — the step
+succeeds having restored nothing — so drift here shows up only as slow jobs.
diff --git a/.github/actions/tend-setup/action.yaml b/.github/actions/tend-setup/action.yaml
index e9b38e00d..15717097f 100644
--- a/.github/actions/tend-setup/action.yaml
+++ b/.github/actions/tend-setup/action.yaml
@@ -12,6 +12,17 @@ inputs:
runs:
using: composite
steps:
+ # Above the cache step on purpose: rust-cache hashes the CARGO*/RUST* vars
+ # visible at its own step into the key, so these have to be set first, and
+ # have to match what ci.yaml's workflow `env:` block gives the jobs that
+ # write the shared cache (see "Build environment" in .github/CLAUDE.md).
+ - name: Set build environment
+ shell: bash
+ run: |
+ echo "CARGO_TERM_COLOR=always" >> "$GITHUB_ENV"
+ echo "CARGO_INCREMENTAL=0" >> "$GITHUB_ENV"
+ echo "RUSTFLAGS=-C debuginfo=0" >> "$GITHUB_ENV"
+
- name: Install cargo-insta
if: inputs.install-cargo-tools == 'true'
uses: baptiste0928/cargo-install@v3
@@ -29,7 +40,14 @@ runs:
- name: "\U0001F4B0 Cache"
uses: Swatinem/rust-cache@v2
with:
- prefix-key: ${{ hashFiles('Cargo.lock') }}
+ # Restore the shared cache `test-setup`'s jobs publish from main; never
+ # save (tend jobs would deposit single-use entries against the 10 GB
+ # repo cap). Each field has to match what those jobs compute or the
+ # restore silently misses, as the old `hashFiles('Cargo.lock')` prefix
+ # and job-name shared-key did.
+ cache-bin: false
+ prefix-key: v1-rust
+ shared-key: shared
save-if: false
- name: Install uv
@@ -47,11 +65,3 @@ runs:
run: |
sudo apt-get update
sudo apt-get install -y zsh fish
-
- - name: Set build environment
- shell: bash
- run: |
- echo "CARGO_TERM_COLOR=always" >> "$GITHUB_ENV"
- echo "CARGO_INCREMENTAL=0" >> "$GITHUB_ENV"
- echo "RUSTFLAGS=-C debuginfo=0" >> "$GITHUB_ENV"
- echo "RUSTDOCFLAGS=-Dwarnings" >> "$GITHUB_ENV"