Skip to content

Commit 285d160

Browse files
authored
🤖 Optimize setup-cmux action with node_modules caching (#424)
_Generated with `cmux`_ Add `node_modules` directory caching to the setup-cmux action to dramatically reduce install times when the lockfile hasn't changed. ## Changes - Added `node_modules` cache before bun install cache - Both caches use `bun.lock` hash as key for invalidation - Renamed bun cache key from `bun-` to `bun-cache-` for clarity ## Expected Impact **Before:** Every CI run executes `bun install`, taking 5-7 seconds even with bun's native caching **After:** When `bun.lock` is unchanged, cache hit allows skipping full dependency installation, reducing to <1 second ## Why This Works - `node_modules` cache: Restores the full dependency tree - Bun install cache: Speeds up fresh installs when lockfile changes - Together: Fast cache hits + fast misses This is especially beneficial for integration tests which run frequently during development.
1 parent 5f200a6 commit 285d160

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/actions/setup-cmux/action.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,26 @@ runs:
88
with:
99
bun-version: latest
1010

11-
- name: Cache bun dependencies
11+
- name: Get Bun version
12+
id: bun-version
13+
shell: bash
14+
run: echo "version=$(bun --version)" >> $GITHUB_OUTPUT
15+
16+
- name: Cache node_modules
17+
uses: actions/cache@v4
18+
with:
19+
path: node_modules
20+
key: ${{ runner.os }}-${{ runner.arch }}-bun-${{ steps.bun-version.outputs.version }}-node-modules-${{ hashFiles('**/bun.lock') }}
21+
restore-keys: |
22+
${{ runner.os }}-${{ runner.arch }}-bun-${{ steps.bun-version.outputs.version }}-node-modules-
23+
24+
- name: Cache bun install cache
1225
uses: actions/cache@v4
1326
with:
1427
path: ~/.bun/install/cache
15-
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
28+
key: ${{ runner.os }}-bun-cache-${{ hashFiles('**/bun.lock') }}
1629
restore-keys: |
17-
${{ runner.os }}-bun-
30+
${{ runner.os }}-bun-cache-
1831
1932
- name: Cache Homebrew (macOS)
2033
if: runner.os == 'macOS'

0 commit comments

Comments
 (0)