From 2717a14b4a73371de4fe60b79c52b0eade9c8c5f Mon Sep 17 00:00:00 2001 From: tignear Date: Thu, 29 Oct 2026 04:56:42 +0900 Subject: [PATCH] ci: key the vtest dependency cache by the executor's build plan After #2467 moved the test build to the `vtest` profile, Rust Tests jobs still restored the old `vtest-v1` cache, built for the previous plan, and compiled the dependencies again in the executor step (10 minutes and more). The warm workflow ran on the merge but found the same key and skipped its build, since the rust-cache key does not change with Cargo commands or profiles. Key the cache by `scripts/run-vtest.mjs`, which holds the executor's profile, scope and features, in both CI and the warm workflow. A change of the plan is then a new key that the warm run on master populates. Validation: repository workflow tests (26) pass, including the key parity between CI and the warm workflow; actionlint reports only its unknown `ubuntu-26.04-arm` label. Change-Id: I9b8d55c3142c7a3b00a751b6f005cbb57fa5d2f4 --- .github/workflows/ci.yml | 4 +++- .github/workflows/rust-cache.yml | 4 +++- scripts/ci-workflow.test.mjs | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) 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'/);