fix: normalize rust cache keys
This commit is contained in:
@@ -24,6 +24,8 @@ runs:
|
||||
id: cache-key
|
||||
shell: bash
|
||||
run: |
|
||||
OS=$(printf '%s' '${{ runner.os }}' | tr '[:upper:]' '[:lower:]')
|
||||
ARCH=$(printf '%s' '${{ runner.arch }}' | tr '[:upper:]' '[:lower:]')
|
||||
{
|
||||
printf 'toolchain=%s\n' '${{ inputs.toolchain }}'
|
||||
find . \
|
||||
@@ -35,8 +37,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 }}-${{ runner.os }}-${{ runner.arch }}-${{ inputs.toolchain }}-$HASH" >> $GITHUB_OUTPUT
|
||||
echo "restore-prefix=${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-${{ inputs.toolchain }}-" >> $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
|
||||
|
||||
- name: Restore Rust cache
|
||||
id: cache-restore
|
||||
@@ -54,6 +56,12 @@ runs:
|
||||
restore-keys: |
|
||||
${{ steps.cache-key.outputs.restore-prefix }}
|
||||
|
||||
- name: Show Rust cache status
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Rust cache key: ${{ steps.cache-key.outputs.key }}"
|
||||
echo "Rust cache hit: ${{ steps.cache-restore.outputs.cache-hit }}"
|
||||
|
||||
- name: Setup Rust
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user