Next.js
Next.js CI on GitHub Actions
next build recompiles every page even when one component changed.
5m → 90s
Build
93%
Cache hit rate
next build recompiles every page even when one component changed.
Why it happens
The .next/cache directory holds the incremental build cache and is discarded between runs.
What to change
- Cache .next/cache keyed on the lockfile plus source hash
- Turn on Turbopack builds where your app supports them
- Split typecheck and lint into parallel jobs so they do not serialise the build
- Use a 4 vCPU runner with NVMe — Next builds are heavily I/O bound
Next.js on runnerhut
yaml
jobs: build: runs-on: runnerhut-4vcpu-ubuntu-2404 steps: - uses: actions/checkout@v4 - uses: actions/cache@v4 with: path: .next/cache key: next-${{ hashFiles('**/package-lock.json') }}-${{ github.sha }} restore-keys: next-${{ hashFiles('**/package-lock.json') }}- - run: npm ci && npm run buildThe only runnerhut-specific line is `runs-on: runnerhut-4vcpu-ubuntu-2404`. Everything else is standard GitHub Actions — the same actions, the same secrets and the same permissions model you use today.
Your next build could be twice as fast, at half the price
Start free. Migrating away is the same one line, and we publish that diff too.