From f2e64a6f780dac37e43b88791e45aa787e6430ed Mon Sep 17 00:00:00 2001 From: Michal R Date: Sat, 6 Dec 2025 13:51:04 +0100 Subject: [PATCH] ci: Use nightly version as a cache prefix in jobs using both nightly and stable This way we make sure that the cache is invalidated once we are on a new nightly version. --- .github/workflows/ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d724ca5..3a649a68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -152,7 +152,15 @@ jobs: # Installed *after* nightly so it is the default. - uses: dtolnay/rust-toolchain@stable + - id: nightly-prefix + run: | + set -euo pipefail + prefix="$(rustc +nightly --version --verbose | awk '/commit-date/ {print "nightly-" $2}')" + echo "value=$prefix" >> "$GITHUB_OUTPUT" + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: ${{ steps.nightly-prefix.outputs.value }} - run: cargo install --git https://github.com/aya-rs/bpf-linker.git bpf-linker --features llvm-21 @@ -294,7 +302,15 @@ jobs: with: targets: aarch64-unknown-linux-musl,x86_64-unknown-linux-musl + - id: nightly-prefix + run: | + set -euo pipefail + prefix="$(rustc +nightly --version --verbose | awk '/commit-date/ {print "nightly-" $2}')" + echo "value=$prefix" >> "$GITHUB_OUTPUT" + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: ${{ steps.nightly-prefix.outputs.value }} - name: Install libLLVM # Download libLLVM from Rust CI to ensure that the libLLVM version