Skip to content

Commit a09481c

Browse files
ci: add cache-suffix to isolate sanitizer build cache (#5604)
## Summary - Add `cache-suffix` input to `setup-rust` action to allow jobs with different RUSTFLAGS to use separate caches - Use `cache-suffix: "sanitizer"` for the sanitizer test job to prevent cache pollution between sanitizer and non-sanitizer builds
1 parent 80e01eb commit a09481c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.github/actions/setup-rust/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ inputs:
1515
targets:
1616
description: "optional targets override (e.g. wasm32-unknown-unknown)"
1717
required: false
18+
cache-suffix:
19+
description: "optional suffix for cache key to isolate builds with different RUSTFLAGS (e.g. 'sanitizer')"
20+
required: false
21+
default: ""
1822

1923
runs:
2024
using: "composite"
@@ -48,7 +52,7 @@ runs:
4852
uses: Swatinem/rust-cache@v2
4953
with:
5054
save-if: ${{ github.ref_name == 'develop' }}
51-
shared-key: "rust-cache-${{ runner.os }}-${{ runner.arch }}-${{ runner.environment }}-${{ steps.toolchain-config.outputs.toolchain }}-${{ steps.toolchain-config.outputs.targets }}"
55+
shared-key: "rust-cache-${{ runner.os }}-${{ runner.arch }}-${{ runner.environment }}-${{ steps.toolchain-config.outputs.toolchain }}-${{ steps.toolchain-config.outputs.targets }}${{ inputs.cache-suffix && format('-{0}', inputs.cache-suffix) || '' }}"
5256

5357
- name: Rust Compile Cache
5458
uses: mozilla-actions/[email protected]

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ jobs:
421421
repo-token: ${{ secrets.GITHUB_TOKEN }}
422422
toolchain: nightly
423423
components: "rust-src, rustfmt, clippy, llvm-tools-preview"
424+
cache-suffix: "sanitizer"
424425
- name: Install build dependencies
425426
run: |
426427
sudo apt-get update

0 commit comments

Comments
 (0)