From da6f45f69c4f744b99acfc136efb3543a42ee1f7 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Fri, 12 Jun 2026 15:38:19 +0800 Subject: [PATCH] ci: single, workspace-aware rust-cache for build_tauri_app (#4550) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci(pull-request): cache the vendored tauri workspace crates build_tauri_app rebuilt the whole tauri stack every run. The fork is wired via [patch.crates-io] to path crates (packages/tauri, packages/tauri-plugins) plus local src-tauri/plugins/*, all workspace members that Swatinem/rust-cache prunes by default (cache-workspace-crates: false). Every crates.io plugin depending on the patched `tauri` then rebuilt transitively, while unrelated deps stayed cached. Set cache-workspace-crates: true so those sporadically-updated submodule crates are cached, and bump the cache key (tauri-cargo -> tauri-cargo-ws) so the old workspace-crate-less cache is invalidated and repopulated (rust-cache won't re-save on a full key match). The first run after this is a full rebuild; subsequent runs reuse the cached tauri stack. Co-Authored-By: Claude Opus 4.8 (1M context) * ci(pull-request): keep a single rust-cache for build_tauri_app build_tauri_app ran two rust-cache actions: actions-rust-lang/setup-rust-toolchain's built-in one (cache-workspace-crates: false) plus the explicit Swatinem/rust-cache. They doubled cache storage and competed over the shared target/. Set cache: false on setup-rust-toolchain so the explicit cache — the one configured with cache-workspace-crates for the vendored tauri fork — is the only one. Co-Authored-By: Claude Opus 4.8 (1M context) --------- Co-authored-by: Claude Opus 4.8 (1M context) --- .github/workflows/pull-request.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index d00a1ba2..1e679b8f 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -297,11 +297,26 @@ jobs: uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1 with: toolchain: stable + # Disable this action's built-in rust-cache so the explicit + # Swatinem/rust-cache below is the single cache (it's the one + # configured with cache-workspace-crates for the vendored tauri fork). + cache: false - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 with: - key: tauri-cargo + # cache-workspace-crates caches the path/workspace crates too: the + # vendored tauri fork (packages/tauri, packages/tauri-plugins, wired + # via [patch.crates-io]) and the local src-tauri/plugins/*. These are + # workspace members that rust-cache prunes by default, so the whole + # tauri stack — plus every crates.io plugin that depends on the + # patched `tauri` — rebuilt on every run. They change only + # sporadically (pinned submodules), so caching them is a big win. + # The key is bumped (-ws) so the old workspace-crate-less cache is + # invalidated and the next run repopulates it with the workspace + # crates included. + key: tauri-cargo-ws cache-all-crates: 'true' + cache-workspace-crates: 'true' - name: Cache apt packages uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5