From d3386908ff544a44bf7399f7276979e617fef12c Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Fri, 31 Oct 2025 19:37:28 +0800 Subject: [PATCH] fix: improve caching strategy for autobuild jobs --- .github/workflows/autobuild.yml | 33 ++++++++++++++++++++++++++++--- .github/workflows/lint-clippy.yml | 5 +++-- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 793a1c59..50c6617b 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -169,7 +169,8 @@ jobs: workspaces: src-tauri cache-all-crates: true save-if: ${{ github.ref == 'refs/heads/dev' }} - shared-key: autobuild-shared + shared-key: autobuild-${{ runner.os }}-${{ matrix.target }} + key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('src-tauri/Cargo.lock') }} - name: Install dependencies (ubuntu only) if: matrix.os == 'ubuntu-22.04' @@ -197,6 +198,14 @@ jobs: node-version: "22" cache: "pnpm" + - name: Cache pnpm store + uses: actions/cache@v4 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm- + - name: Pnpm install and check run: | pnpm i @@ -259,7 +268,8 @@ jobs: workspaces: src-tauri cache-all-crates: true save-if: ${{ github.ref == 'refs/heads/dev' }} - shared-key: autobuild-shared + shared-key: autobuild-${{ runner.os }}-${{ matrix.target }} + key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('src-tauri/Cargo.lock') }} - name: Install pnpm uses: pnpm/action-setup@v4 @@ -272,6 +282,14 @@ jobs: node-version: "22" cache: "pnpm" + - name: Cache pnpm store + uses: actions/cache@v4 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm- + - name: Pnpm install and check run: | pnpm i @@ -391,7 +409,8 @@ jobs: workspaces: src-tauri cache-all-crates: true save-if: ${{ github.ref == 'refs/heads/dev' }} - shared-key: autobuild-shared + shared-key: autobuild-${{ runner.os }}-${{ matrix.target }} + key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('src-tauri/Cargo.lock') }} - name: Install pnpm uses: pnpm/action-setup@v4 @@ -404,6 +423,14 @@ jobs: node-version: "22" cache: "pnpm" + - name: Cache pnpm store + uses: actions/cache@v4 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm- + - name: Pnpm install and check run: | pnpm i diff --git a/.github/workflows/lint-clippy.yml b/.github/workflows/lint-clippy.yml index 38ca85c0..30ed828b 100644 --- a/.github/workflows/lint-clippy.yml +++ b/.github/workflows/lint-clippy.yml @@ -59,9 +59,10 @@ jobs: uses: Swatinem/rust-cache@v2 with: workspaces: src-tauri + cache-all-crates: true save-if: false - cache-all-crates: false - shared-key: autobuild-shared + shared-key: autobuild-${{ runner.os }}-${{ matrix.target }} + key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('src-tauri/Cargo.lock') }} - name: Install dependencies (ubuntu only) if: matrix.os == 'ubuntu-22.04'