From 9195924f7753c965486857187705189f73c6b662 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 83b0f02b7c..faf5dc0fce 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -41,6 +41,11 @@ jobs: # figure out native target triple while we're at it - name: install rust-toolchain run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV" + - 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 @@ -94,6 +99,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 }} @@ -138,6 +148,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 @@ -173,6 +188,11 @@ jobs: sudo apt install -y xvfb libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers - 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: cargo fetch --locked difftests @@ -220,6 +240,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 bb7f0d1d200d762b23ceb785b81b9d6455f5a84e 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 faf5dc0fce..89e99ae4f6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -43,9 +43,8 @@ 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" # Fetch dependencies in a separate step to clearly show how long each part # of the testing takes - name: cargo fetch --locked @@ -101,9 +100,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 }} @@ -150,9 +148,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 @@ -190,9 +188,14 @@ 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" + - 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 @@ -240,11 +243,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 d08ce6e2f35a7a5b4e105a7a6a3fabfb962090b7 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 89e99ae4f6..80a4f06a86 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -80,6 +80,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 6746cbdb9aee6d1b7ac15041086cddce2031f8b4 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 80a4f06a86..f58479c447 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,6 +45,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 @@ -85,6 +86,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" @@ -112,6 +114,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 }}