fix: improve caching strategy for autobuild jobs

This commit is contained in:
Tunglies
2025-10-31 19:37:28 +08:00
parent 59e7095b0f
commit d3386908ff
2 changed files with 33 additions and 5 deletions

View File

@@ -169,7 +169,8 @@ jobs:
workspaces: src-tauri workspaces: src-tauri
cache-all-crates: true cache-all-crates: true
save-if: ${{ github.ref == 'refs/heads/dev' }} 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) - name: Install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-22.04' if: matrix.os == 'ubuntu-22.04'
@@ -197,6 +198,14 @@ jobs:
node-version: "22" node-version: "22"
cache: "pnpm" 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 - name: Pnpm install and check
run: | run: |
pnpm i pnpm i
@@ -259,7 +268,8 @@ jobs:
workspaces: src-tauri workspaces: src-tauri
cache-all-crates: true cache-all-crates: true
save-if: ${{ github.ref == 'refs/heads/dev' }} 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 - name: Install pnpm
uses: pnpm/action-setup@v4 uses: pnpm/action-setup@v4
@@ -272,6 +282,14 @@ jobs:
node-version: "22" node-version: "22"
cache: "pnpm" 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 - name: Pnpm install and check
run: | run: |
pnpm i pnpm i
@@ -391,7 +409,8 @@ jobs:
workspaces: src-tauri workspaces: src-tauri
cache-all-crates: true cache-all-crates: true
save-if: ${{ github.ref == 'refs/heads/dev' }} 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 - name: Install pnpm
uses: pnpm/action-setup@v4 uses: pnpm/action-setup@v4
@@ -404,6 +423,14 @@ jobs:
node-version: "22" node-version: "22"
cache: "pnpm" 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 - name: Pnpm install and check
run: | run: |
pnpm i pnpm i

View File

@@ -59,9 +59,10 @@ jobs:
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with: with:
workspaces: src-tauri workspaces: src-tauri
cache-all-crates: true
save-if: false save-if: false
cache-all-crates: false shared-key: autobuild-${{ runner.os }}-${{ matrix.target }}
shared-key: autobuild-shared key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('src-tauri/Cargo.lock') }}
- name: Install dependencies (ubuntu only) - name: Install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-22.04' if: matrix.os == 'ubuntu-22.04'