diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f114b6dd93..a7bcaf86474 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -247,7 +247,9 @@ jobs: - uses: Swatinem/rust-cache@v2 with: - key: vtest-v1 + # The vtest executor's build plan (profile, scope, features) lives in + # run-vtest.mjs; a change of it is a different cache. + key: vtest-${{ hashFiles('scripts/run-vtest.mjs') }} save-if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} - name: Initialize Rust test reports diff --git a/.github/workflows/rust-cache.yml b/.github/workflows/rust-cache.yml index 78b9386e612..5fdc8fd8895 100644 --- a/.github/workflows/rust-cache.yml +++ b/.github/workflows/rust-cache.yml @@ -48,7 +48,9 @@ jobs: - uses: Swatinem/rust-cache@v2 id: cache with: - key: vtest-v1 + # The vtest executor's build plan (profile, scope, features) lives in + # run-vtest.mjs; a change of it is a different cache. + key: vtest-${{ hashFiles('scripts/run-vtest.mjs') }} - name: Install cargo-nextest if: steps.cache.outputs.cache-hit != 'true' uses: taiki-e/install-action@v2 diff --git a/scripts/ci-workflow.test.mjs b/scripts/ci-workflow.test.mjs index 408d4a8933e..186149c511c 100644 --- a/scripts/ci-workflow.test.mjs +++ b/scripts/ci-workflow.test.mjs @@ -372,7 +372,7 @@ test("cache warming shares the Rust Tests key and builds without running tests", ); assert.match(warm, /steps.cache.outputs.cache-hit != 'true'/); for (const text of [warm, job("rust-tests")]) { - assert.match(text, /key: vtest-v1/); + assert.match(text, /key: vtest-\$\{\{ hashFiles\('scripts\/run-vtest\.mjs'\) \}\}/); assert.match(text, /run: node scripts\/run-vtest.mjs --prepare-ci/); } assert.match(warm, /name: Build the optimized vtest executor to populate dependencies\n if: steps.cache.outputs.cache-hit != 'true'/);