From d8749d13a0789ca41c5f511911d81e808becf3cf Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Sun, 3 May 2026 16:45:02 -0700 Subject: [PATCH] fix: bump rust cache format --- .gitea/actions/rust-cache/action.yml | 8 ++++++-- README.md | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitea/actions/rust-cache/action.yml b/.gitea/actions/rust-cache/action.yml index e567128..ab20df5 100644 --- a/.gitea/actions/rust-cache/action.yml +++ b/.gitea/actions/rust-cache/action.yml @@ -11,6 +11,10 @@ inputs: description: Prefix for cache keys. default: rust required: false + cache-version: + description: Cache format version. Bump this to avoid reusing stale or partial cache entries. + default: v2 + required: false outputs: cache-hit: @@ -37,8 +41,8 @@ runs: } > /tmp/rust-cache-fingerprint HASH=$(sha256sum /tmp/rust-cache-fingerprint | cut -d' ' -f1) echo "hash=$HASH" >> $GITHUB_OUTPUT - echo "key=${{ inputs.cache-prefix }}-$OS-$ARCH-${{ inputs.toolchain }}-$HASH" >> $GITHUB_OUTPUT - echo "restore-prefix=${{ inputs.cache-prefix }}-$OS-$ARCH-${{ inputs.toolchain }}-" >> $GITHUB_OUTPUT + echo "key=${{ inputs.cache-prefix }}-${{ inputs.cache-version }}-$OS-$ARCH-${{ inputs.toolchain }}-$HASH" >> $GITHUB_OUTPUT + echo "restore-prefix=${{ inputs.cache-prefix }}-${{ inputs.cache-version }}-$OS-$ARCH-${{ inputs.toolchain }}-" >> $GITHUB_OUTPUT - name: Restore Rust cache id: cache-restore diff --git a/README.md b/README.md index 97a22f6..dd9d1a0 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ jobs: with: toolchain: stable # optional, defaults to stable cache-prefix: rust # optional, defaults to rust + cache-version: v2 # optional, defaults to v2 - run: cargo build --release - run: cargo test @@ -35,7 +36,7 @@ jobs: ### Cache key format ``` -{cache-prefix}-{runner.os}-{runner.arch}-{toolchain}-{hash(manifests/toolchain files)} +{cache-prefix}-{cache-version}-{runner.os}-{runner.arch}-{toolchain}-{hash(manifests/toolchain files)} ``` Warm builds run in ~40–60s vs ~3min for a cold build.