chore(ci): add GitHub Actions workflow running tsc + eslint + build

Pre-commit (bceacc8) catches local commits, but anything pushed with
--no-verify or arriving via a PR from a fork bypasses it. Add a
GitHub Actions workflow that runs the same checks on origin (push to
main and every PR) plus a `next build` to catch issues that only
surface during compilation.

- Node 22 with npm cache (subsequent runs reuse node_modules)
- Concurrency: cancels in-progress runs on the same ref so quick
  commit chains don't waste minutes
- DATABASE_URL is set to a syntactically-valid stub so src/db/index.ts
  doesn't throw at module-load; postgres-js pools lazily, no real
  connection happens during build

Belt-and-suspenders with the husky hook and Vercel's own build —
covers the case where Vercel is down or the PR author skipped local
hooks.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
g-butandClaude Opus 4.7 committed 2026-04-26 11:40:45 +02:00
1 parent bceacc8222
commit cca31135c7
1 file changed
+39
+39
View File
@@ -0,0 +1,39 @@
name: CI
on:
push:
branches: [main]
pull_request:
# Cancel in-progress runs of the same workflow on the same branch — saves
# minutes when commits land in quick succession.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Type check
run: npx tsc --noEmit
- name: Lint
run: npx eslint src/
- name: Build
run: npm run build
env:
# Fail fast if a real DB connection is needed during build —
# the build should be DB-agnostic. If a route imports server
# code that hits the DB at module load, the build will surface it.
DATABASE_URL: postgresql://ci:ci@localhost/ci_unused