From 7a81a673f322ef2c654c19afb3b8525c4d9da703 Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Tue, 18 Nov 2025 16:13:19 +0800 Subject: [PATCH] chore(ci): update Rust cache configuration in autobuild and lint-clippy workflows for improved efficiency --- .github/workflows/autobuild.yml | 27 ++++++++++++++++++--------- .github/workflows/lint-clippy.yml | 11 +++++++---- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 26d98901b..85fcd3be1 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -156,10 +156,13 @@ jobs: - name: Rust Cache uses: Swatinem/rust-cache@v2 with: - workspaces: src-tauri - cache-all-crates: true save-if: ${{ github.ref == 'refs/heads/dev' }} - key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**Cargo.lock') }} + prefix-key: "v1-rust" + key: "rust-shared-stable-${{ matrix.os }}-${{ matrix.target }}" + workspaces: | + . -> target + cache-all-crates: false + cache-workspace-crates: true - name: Install dependencies (ubuntu only) if: matrix.os == 'ubuntu-22.04' @@ -264,10 +267,13 @@ jobs: - name: Rust Cache uses: Swatinem/rust-cache@v2 with: - workspaces: src-tauri - cache-all-crates: true save-if: ${{ github.ref == 'refs/heads/dev' }} - key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**Cargo.lock') }} + prefix-key: "v1-rust" + key: "rust-shared-stable-${{ matrix.os }}-${{ matrix.target }}" + workspaces: | + . -> target + cache-all-crates: false + cache-workspace-crates: true - name: Install pnpm uses: pnpm/action-setup@v4 @@ -411,10 +417,13 @@ jobs: - name: Rust Cache uses: Swatinem/rust-cache@v2 with: - workspaces: src-tauri - cache-all-crates: true save-if: ${{ github.ref == 'refs/heads/dev' }} - key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**Cargo.lock') }} + prefix-key: "v1-rust" + key: "rust-shared-stable-${{ matrix.os }}-${{ matrix.target }}" + workspaces: | + . -> target + cache-all-crates: false + cache-workspace-crates: true - name: Install pnpm uses: pnpm/action-setup@v4 diff --git a/.github/workflows/lint-clippy.yml b/.github/workflows/lint-clippy.yml index 251b326e5..655d5b3e2 100644 --- a/.github/workflows/lint-clippy.yml +++ b/.github/workflows/lint-clippy.yml @@ -58,10 +58,13 @@ jobs: - name: Rust Cache uses: Swatinem/rust-cache@v2 with: - workspaces: src-tauri - cache-all-crates: true - save-if: false - key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**Cargo.lock') }} + save-if: ${{ github.ref == 'refs/heads/dev' }} + prefix-key: "v1-rust" + key: "rust-shared-stable-${{ matrix.os }}-${{ matrix.target }}" + workspaces: | + . -> target + cache-all-crates: false + cache-workspace-crates: true - name: Install dependencies (ubuntu only) if: matrix.os == 'ubuntu-22.04'