Skip to content

Commit b6a14d0

Browse files
lwwmanningclaude
andauthored
Cache Bun install + Next.js build artifacts in CI (#57)
Signed-off-by: Will Manning <will@willmanning.io> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 35b828b commit b6a14d0

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ on:
55
branches: [main]
66
pull_request:
77

8+
# Cancel in-flight runs for the same workflow + ref. Including
9+
# `github.workflow` in the key keeps this from colliding with any other
10+
# workflow that happens to share a ref-based group prefix.
811
concurrency:
9-
group: ci-${{ github.ref }}
12+
group: ci-${{ github.workflow }}-${{ github.ref }}
1013
cancel-in-progress: true
1114

1215
# Least-privilege: this workflow only reads the repo to lint/build/verify; it
@@ -34,6 +37,31 @@ jobs:
3437
with:
3538
node-version-file: .nvmrc
3639

40+
# Cache Bun's resolved package store keyed on the lockfile hash. Cuts
41+
# ~10s off `bun install` on a clean runner; the restore-key falls back
42+
# to any prior cache from this OS so partial hits still help.
43+
- name: Cache Bun install cache
44+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
45+
with:
46+
path: ~/.bun/install/cache
47+
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
48+
restore-keys: |
49+
${{ runner.os }}-bun-
50+
51+
# Cache Next.js's incremental build output. Keyed on lockfile + commit
52+
# SHA so the exact-key match is always per-commit fresh; restore-keys
53+
# fall back to any previous build on the same lockfile, then any build
54+
# on this OS — so most CI runs hit a cache and skip rebuilding
55+
# unchanged webpack modules.
56+
- name: Cache Next.js build cache
57+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
58+
with:
59+
path: ${{ github.workspace }}/.next/cache
60+
key: ${{ runner.os }}-nextjs-${{ hashFiles('bun.lock') }}-${{ github.sha }}
61+
restore-keys: |
62+
${{ runner.os }}-nextjs-${{ hashFiles('bun.lock') }}-
63+
${{ runner.os }}-nextjs-
64+
3765
- name: Install
3866
run: bun install --frozen-lockfile
3967

0 commit comments

Comments
 (0)