Skip to content

Merge branch 'staging' of github.com:ncdai/chanhdai.com into staging #7

Merge branch 'staging' of github.com:ncdai/chanhdai.com into staging

Merge branch 'staging' of github.com:ncdai/chanhdai.com into staging #7

Workflow file for this run

name: CI
on:
# Gate for merging into main (required by branch protection); runs against the
# merge result before merge. Production deploy is gated by this PR check, so a
# redundant push-to-main run is intentionally omitted.
pull_request:
branches: [main]
# Early feedback while iterating on staging.
push:
branches: [staging]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
verify:
runs-on: ubuntu-latest
env:
# Public, non-secret API base used at build/prerender time by
# src/features/portfolio/data/github-contributions.ts (which has NO
# fallback for this var — see "Why the step order / env matters" below).
# Value is the public default from .env.example; safe to hardcode.
GITHUB_CONTRIBUTIONS_API_URL: https://github-contributions-api.jogruber.de
steps:
- uses: actions/checkout@v4
- name: Install Bun
uses: oven-sh/setup-bun@v2
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 11.5.3
- name: Install Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Format check
run: pnpm format:check
- name: Test
run: pnpm test:run
# Persist Next.js's build cache (.next/cache) between runs to avoid the
# "No Cache Detected" warning and speed up rebuilds. The pnpm store is
# already cached via `cache: pnpm` on setup-node, so only .next/cache is
# cached here. Key busts on lockfile or source changes; restore-keys falls
# back to the latest cache for the same lockfile when only source changed.
# hashFiles has no brace expansion, so extensions are listed explicitly.
- name: Cache Next.js build
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('src/**/*.js', 'src/**/*.jsx', 'src/**/*.ts', 'src/**/*.tsx', 'src/**/*.mdx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-
# Build MUST run before Typecheck: `tsc --noEmit` depends on the
# `PageProps` global that Next.js generates into `.next/types/**` during
# `next build`. On a fresh checkout (no `.next/`), `pnpm check-types` fails
# with "Cannot find name 'PageProps'" until a build has generated those types.
- name: Build (includes registry build via Bun)
run: pnpm build
- name: Typecheck
run: pnpm check-types
- name: Validate registry
run: pnpm registry:validate