Commit 2ad03c4
authored
🤖 perf: skip redundant bun cache restore when node_modules exists (#1026)
## Problem
Windows builds were taking ~8 minutes, with setup-mux taking ~2.5
minutes.
### Root Cause
The `cache-hit` output from `actions/cache` is `false` for partial
restore-key matches. This caused:
1. node_modules cache restored via restore-key → `cache-hit='false'`
2. Bun install cache also restored (275MB) → 88s decompression on
Windows tar/zstd
3. `bun install` runs but is a no-op (node_modules exists)
4. Post-job: both caches re-saved with new keys (~77s combined)
### Timeline breakdown (from [this
run](https://github.com/coder/mux/actions/runs/20063325241/job/57545464568)):
| Step | Duration |
|------|----------|
| Restore node_modules | 30s |
| **Restore bun cache** | **88s** ← wasted |
| bun install | 0.5s |
| choco install make | 12s |
| bun run build | 53s |
| make dist-win | 163s |
| **Post: save caches** | **77s** ← partially wasted |
## Solution
Check if `node_modules/.bin` actually exists after cache restore,
instead of relying on `cache-hit` output. This is more reliable for
determining if we need to install dependencies.
## Expected improvement
~88-165 seconds saved on Windows builds when lockfile hash changes
(partial cache hit scenario).
_Generated with `mux`_1 parent dfaf29c commit 2ad03c4
1 file changed
+14
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
25 | 37 | | |
26 | | - | |
| 38 | + | |
27 | 39 | | |
28 | 40 | | |
29 | 41 | | |
| |||
33 | 45 | | |
34 | 46 | | |
35 | 47 | | |
36 | | - | |
| 48 | + | |
37 | 49 | | |
38 | 50 | | |
0 commit comments