@@ -21,6 +21,8 @@ permissions:
2121env :
2222 CARGO_TERM_COLOR : always
2323 RUST_BACKTRACE : 1
24+ # Faster git fetches for cargo
25+ CARGO_NET_GIT_FETCH_WITH_CLI : true
2426 # Cache keys for better hit rates
2527 RUST_CACHE_KEY : v1
2628 PLAYWRIGHT_BROWSERS_PATH : ${{ github.workspace }}/.cache/ms-playwright
8183 node-version : 20
8284 cache : ' pnpm'
8385
86+ # Cache pnpm store for faster installs
87+ - name : Get pnpm store directory
88+ shell : bash
89+ run : echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
90+
91+ - name : Cache pnpm store
92+ uses : actions/cache@v4
93+ with :
94+ path : ${{ env.STORE_PATH }}
95+ key : pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
96+ restore-keys : |
97+ pnpm-store-${{ runner.os }}-
98+
8499 - run : pnpm install --frozen-lockfile
85100 - run : pnpm typecheck
86101 - run : pnpm lint
@@ -132,9 +147,12 @@ jobs:
132147 with :
133148 targets : ${{ matrix.target }}
134149
150+ # Share cache between rust-test and build jobs for faster compilation
135151 - uses : Swatinem/rust-cache@v2
136152 with :
137153 key : ${{ matrix.target }}
154+ shared-key : rust-${{ matrix.target }}
155+ cache-on-failure : true
138156
139157 # Install cargo-nextest
140158 - name : Install nextest
@@ -171,6 +189,7 @@ jobs:
171189
172190 # ─────────────────────────────────────────────────────────────
173191 # Build Verification (ensures app compiles on all platforms)
192+ # Runs after checks pass; uses cached Rust build artifacts
174193 # ─────────────────────────────────────────────────────────────
175194 build :
176195 needs : [rust-check, ts-check]
@@ -199,23 +218,64 @@ jobs:
199218 env :
200219 PKG_CONFIG_PATH : /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
201220
221+ # Use shared cache key so builds benefit from rust-test artifacts
202222 - uses : Swatinem/rust-cache@v2
203223 with :
204- key : ${{ matrix.target }}-build
224+ key : ${{ matrix.target }}
225+ shared-key : rust-${{ matrix.target }}
226+ cache-on-failure : true
205227 env :
206228 PKG_CONFIG_PATH : /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
229+
207230 - uses : pnpm/action-setup@v4
208231 - uses : actions/setup-node@v4
209232 with :
210233 node-version : 20
211234 cache : ' pnpm'
212235
236+ # Cache pnpm store
237+ - name : Get pnpm store directory
238+ shell : bash
239+ run : echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
240+
241+ - name : Cache pnpm store
242+ uses : actions/cache@v4
243+ with :
244+ path : ${{ env.STORE_PATH }}
245+ key : pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
246+ restore-keys : |
247+ pnpm-store-${{ runner.os }}-
248+
249+ # Cache Tauri CLI binary (avoid recompiling on every run)
250+ - name : Cache Tauri CLI
251+ uses : actions/cache@v4
252+ with :
253+ path : |
254+ ~/.cargo/bin/cargo-tauri*
255+ ~/.cargo/bin/tauri*
256+ key : tauri-cli-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
257+ restore-keys : |
258+ tauri-cli-${{ runner.os }}-
259+
213260 - run : pnpm install --frozen-lockfile
214261 - run : pnpm build
215262 env :
216263 PKG_CONFIG_PATH : /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
217264 TAURI_SIGNING_PRIVATE_KEY : ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
218265
266+ # Upload build artifacts for e2e-desktop to reuse (Linux/Windows only)
267+ - name : Upload build artifacts
268+ if : matrix.os != 'macos-latest'
269+ uses : actions/upload-artifact@v4
270+ with :
271+ name : tauri-build-${{ matrix.os }}
272+ path : |
273+ target/release/bundle/
274+ target/release/mcpmux*
275+ target/release/*.exe
276+ retention-days : 1
277+ if-no-files-found : ignore
278+
219279 # ─────────────────────────────────────────────────────────────
220280 # Test Results Report (separate checks per test type and OS)
221281 # Uses dorny/test-reporter for granular GitHub Check Runs
@@ -397,9 +457,10 @@ jobs:
397457 # ─────────────────────────────────────────────────────────────
398458 # E2E Tests (Desktop app with WebDriver - Linux/Windows only)
399459 # Runs when: main branch, [e2e] in commit, or /e2e-desktop comment on PR
460+ # Depends on build to reuse artifacts (avoids rebuilding Tauri ~5-10 min)
400461 # ─────────────────────────────────────────────────────────────
401462 e2e-desktop :
402- needs : [e2e-trigger-check]
463+ needs : [e2e-trigger-check, build ]
403464 if : needs.e2e-trigger-check.outputs.run_e2e == 'true'
404465 uses : ./.github/workflows/e2e-desktop.yml
405466 with :
0 commit comments