From 59b3cda49754a7becad26a54059500f4fd60f668 Mon Sep 17 00:00:00 2001 From: firestar99 Date: Tue, 10 Feb 2026 11:17:02 +0100 Subject: [PATCH 1/4] ci: add rust-cache action after toolchain install --- .github/workflows/ci.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5d5a8a0ee0..442af27397 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -43,6 +43,11 @@ jobs: run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV" - name: install nextest uses: taiki-e/install-action@nextest + - uses: Swatinem/rust-cache@v2 + with: + workspaces: | + . + tests/difftests/tests # Fetch dependencies in a separate step to clearly show how long each part # of the testing takes - name: cargo fetch --locked @@ -96,6 +101,11 @@ jobs: stripdown: true - name: install rust-toolchain run: cargo version + - uses: Swatinem/rust-cache@v2 + with: + workspaces: | + . + tests/difftests/tests - name: cargo fetch --locked run: cargo fetch --locked --target ${{ matrix.target }} @@ -140,6 +150,11 @@ jobs: stripdown: true - name: install rust-toolchain run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV" + - uses: Swatinem/rust-cache@v2 + with: + workspaces: | + . + tests/difftests/tests - name: cargo fetch --locked run: cargo fetch --locked --target $TARGET - name: compiletest @@ -177,6 +192,11 @@ jobs: run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV" - name: install nextest uses: taiki-e/install-action@nextest + - uses: Swatinem/rust-cache@v2 + with: + workspaces: | + . + tests/difftests/tests - name: cargo fetch --locked run: cargo fetch --locked --target $TARGET - name: cargo fetch --locked difftests @@ -350,6 +370,11 @@ jobs: # cargo version is a random command that forces the installation of rust-toolchain - name: install rust-toolchain run: cargo version + - uses: Swatinem/rust-cache@v2 + with: + workspaces: | + . + tests/difftests/tests - name: Install rustup components run: rustup component add rustfmt clippy - name: cargo fetch --locked From ffcd4db716a406ecc10b89e53c2996c1239bb325 Mon Sep 17 00:00:00 2001 From: firestar99 Date: Thu, 12 Feb 2026 12:12:11 +0100 Subject: [PATCH 2/4] ci: reuse rust-cache between different jobs on the same platform, remove cache from lint --- .github/workflows/ci.yaml | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 442af27397..73fd3b7319 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,9 +45,8 @@ jobs: uses: taiki-e/install-action@nextest - uses: Swatinem/rust-cache@v2 with: - workspaces: | - . - tests/difftests/tests + add-job-id-key: "false" + shared-key: "base" # Fetch dependencies in a separate step to clearly show how long each part # of the testing takes - name: cargo fetch --locked @@ -103,9 +102,8 @@ jobs: run: cargo version - uses: Swatinem/rust-cache@v2 with: - workspaces: | - . - tests/difftests/tests + add-job-id-key: "false" + shared-key: "android" - name: cargo fetch --locked run: cargo fetch --locked --target ${{ matrix.target }} @@ -152,9 +150,9 @@ jobs: run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV" - uses: Swatinem/rust-cache@v2 with: - workspaces: | - . - tests/difftests/tests + add-job-id-key: "false" + shared-key: "base" + save-if: "false" - name: cargo fetch --locked run: cargo fetch --locked --target $TARGET - name: compiletest @@ -194,9 +192,14 @@ jobs: uses: taiki-e/install-action@nextest - uses: Swatinem/rust-cache@v2 with: - workspaces: | - . - tests/difftests/tests + add-job-id-key: "false" + shared-key: "base" + save-if: "false" + - uses: Swatinem/rust-cache@v2 + with: + add-job-id-key: "false" + shared-key: "difftest" + workspaces: "tests/difftests/tests" - name: cargo fetch --locked run: cargo fetch --locked --target $TARGET - name: cargo fetch --locked difftests @@ -370,11 +373,6 @@ jobs: # cargo version is a random command that forces the installation of rust-toolchain - name: install rust-toolchain run: cargo version - - uses: Swatinem/rust-cache@v2 - with: - workspaces: | - . - tests/difftests/tests - name: Install rustup components run: rustup component add rustfmt clippy - name: cargo fetch --locked From f7dc38411b177bd69c493778e9f6f8e882f119cd Mon Sep 17 00:00:00 2001 From: firestar99 Date: Fri, 13 Feb 2026 13:47:29 +0100 Subject: [PATCH 3/4] ci: make "test" prep deps cache for compiletests and difftests --- .github/workflows/ci.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 73fd3b7319..2c85d96f38 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -82,6 +82,16 @@ jobs: OUT_DIR: "target/debug/ci/out" run: cargo run -p example-runner-wgpu-builder --no-default-features --features "use-installed-tools" + # Our test runners select very different features for dependencies, so they need to be two separate builds. + # * compiletests depends on `rustc_codegen_spirv` directly with features `use-installed-tools` + # * difftests depends on `spirv-builder` with no features, which excludes `rustc_codegen_spirv` entirely. + # The individual difftest crates depend on it and run the spirv compile, never the test runner itself. + - name: prep cache for other jobs + run: | + cargo build -p compiletests --release --no-default-features --features "use-installed-tools" + cargo build -p difftests --release --no-default-features --features "use-installed-tools" + + android: name: Android strategy: From c36472db0eb3a57b8d5cad6539649eb0bb0c6bf8 Mon Sep 17 00:00:00 2001 From: firestar99 Date: Mon, 16 Feb 2026 17:51:34 +0100 Subject: [PATCH 4/4] ci: only save cache on main --- .github/workflows/ci.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2c85d96f38..eedcf13d49 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -47,6 +47,7 @@ jobs: with: add-job-id-key: "false" shared-key: "base" + save-if: ${{ github.ref_name == 'main' }} # Fetch dependencies in a separate step to clearly show how long each part # of the testing takes - name: cargo fetch --locked @@ -87,6 +88,7 @@ jobs: # * difftests depends on `spirv-builder` with no features, which excludes `rustc_codegen_spirv` entirely. # The individual difftest crates depend on it and run the spirv compile, never the test runner itself. - name: prep cache for other jobs + if: github.ref_name == 'main' run: | cargo build -p compiletests --release --no-default-features --features "use-installed-tools" cargo build -p difftests --release --no-default-features --features "use-installed-tools" @@ -114,6 +116,7 @@ jobs: with: add-job-id-key: "false" shared-key: "android" + save-if: ${{ github.ref_name == 'main' }} - name: cargo fetch --locked run: cargo fetch --locked --target ${{ matrix.target }}