From e01914bffac3571e32dd9b19b000dfeed590d63f Mon Sep 17 00:00:00 2001 From: Michael Suchacz <203725896+ibetitsmike@users.noreply.github.com> Date: Tue, 9 Dec 2025 12:43:24 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20perf:=20skip=20redundant=20bun?= =?UTF-8?q?=20cache=20restore=20when=20node=5Fmodules=20exists?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous logic checked cache-hit output which is false for partial restore-key matches. This caused Windows builds to unnecessarily: 1. Download and decompress the 275MB bun install cache (~88 seconds) 2. Run bun install (which was a no-op since node_modules existed) 3. Re-save both caches at job end (~77 seconds) The fix checks if node_modules/.bin actually exists after cache restore, which is more reliable than the cache-hit output for determining if we need to install dependencies. Expected time savings: ~88-165 seconds on Windows builds (was ~8m, should be ~6m or less). _Generated with mux_ --- .github/actions/setup-mux/action.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-mux/action.yml b/.github/actions/setup-mux/action.yml index 284be5341f..3997d451a6 100644 --- a/.github/actions/setup-mux/action.yml +++ b/.github/actions/setup-mux/action.yml @@ -22,8 +22,20 @@ runs: restore-keys: | ${{ runner.os }}-${{ runner.arch }}-bun-${{ steps.bun-version.outputs.version }}-node-modules- + - name: Check if node_modules exists + id: check-node-modules + shell: bash + run: | + if [ -d "node_modules" ] && [ -d "node_modules/.bin" ]; then + echo "exists=true" >> $GITHUB_OUTPUT + else + echo "exists=false" >> $GITHUB_OUTPUT + fi + + # Only restore bun install cache when node_modules is completely missing. + # This avoids 88+ seconds of tar/zstd decompression on Windows for partial cache hits. - name: Cache bun install cache - if: steps.cache-node-modules.outputs.cache-hit != 'true' + if: steps.check-node-modules.outputs.exists != 'true' id: cache-bun-install uses: actions/cache@v4 with: @@ -33,6 +45,6 @@ runs: ${{ runner.os }}-bun-cache- - name: Install dependencies - if: steps.cache-node-modules.outputs.cache-hit != 'true' + if: steps.check-node-modules.outputs.exists != 'true' shell: bash run: bun install --frozen-lockfile