From 389ff6040b6cfc8fd1187e23b0b57b5c11b74652 Mon Sep 17 00:00:00 2001 From: ginnoir Date: Tue, 2 Jun 2026 02:05:34 -0500 Subject: [PATCH] ci: cache next.js build output and parallelize checks with build --- .github/workflows/ci.yml | 28 +++++++++++++++++++++++++--- Dockerfile | 3 ++- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 291574f..1e8e53e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: pull_request: jobs: - verify: + checks: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -28,10 +28,32 @@ jobs: - run: pnpm format:check + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + with: + version: 10.33.3 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - run: pnpm install --frozen-lockfile + + - uses: actions/cache@v4 + with: + path: .next/cache + key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('src/**/*.ts', 'src/**/*.tsx', 'src/**/*.css') }} + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}- + ${{ runner.os }}-nextjs- + - run: pnpm build env: - # Build only — no DB connection. Provide a placeholder so any - # module-level reads of DATABASE_URL don't crash the build. DATABASE_URL: postgres://placeholder:placeholder@localhost:5432/placeholder AUTH_SECRET: ci-placeholder-secret NEXT_PUBLIC_APP_URL: http://localhost:3000 diff --git a/Dockerfile b/Dockerfile index 3a534ee..da86215 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,8 @@ ENV CI=true ENV NEXT_TELEMETRY_DISABLED=1 COPY . . RUN pnpm install --offline --frozen-lockfile -RUN pnpm build +RUN --mount=type=cache,id=famapp-nextjs,target=/app/.next/cache \ + pnpm build # ── Stage 3: production runtime ─────────────────────────────────────────────── FROM node:22-alpine AS runner