ci: cache next.js build output and parallelize checks with build
This commit is contained in:
@@ -6,7 +6,7 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
verify:
|
checks:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -28,10 +28,32 @@ jobs:
|
|||||||
|
|
||||||
- run: pnpm format:check
|
- 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
|
- run: pnpm build
|
||||||
env:
|
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
|
DATABASE_URL: postgres://placeholder:placeholder@localhost:5432/placeholder
|
||||||
AUTH_SECRET: ci-placeholder-secret
|
AUTH_SECRET: ci-placeholder-secret
|
||||||
NEXT_PUBLIC_APP_URL: http://localhost:3000
|
NEXT_PUBLIC_APP_URL: http://localhost:3000
|
||||||
|
|||||||
+2
-1
@@ -16,7 +16,8 @@ ENV CI=true
|
|||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN pnpm install --offline --frozen-lockfile
|
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 ───────────────────────────────────────────────
|
# ── Stage 3: production runtime ───────────────────────────────────────────────
|
||||||
FROM node:22-alpine AS runner
|
FROM node:22-alpine AS runner
|
||||||
|
|||||||
Reference in New Issue
Block a user