Skip to content

chore(ci): add pre-merge GitHub Actions CI, ESLint flat config, and test DB hardening - #225

Merged
theosiemensrhodes merged 7 commits into
mainfrom
ci/github-actions-draft
Nov 25, 2026
Merged

theosiemensrhodes merged 7 commits into
mainfrom
ci/github-actions-draft

Conversation

@theosiemensrhodes

@theosiemensrhodes theosiemensrhodes commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

main has no pre-merge CI workflow to enforce linting, typechecking, tests, or Docker builds before merge, and several repo issues blocked turning CI on directly:

  • pnpm lint invoked next lint (removed in Next.js 16), and eslint.config.js crashed under eslint-config-next@16 due to FlatCompat circular references plus pre-existing lint debt.
  • tsc --noEmit failed on clean checkouts without generated Next.js types (next-env.d.ts / .next/types).
  • src/test/integration/coverage-service.test.ts hardcoded 2026 shift dates that expired against new Date(), failing 21/23 tests.
  • Vitest ran PostgreSQL globalSetup for pure unit tests, relied on committed credentials in .env.test, and had no guard preventing resetDatabase() from wiping a non-test database.
  • CI/Docker Node 20 was below pg-boss@12.15.0's engines.node >=22.12.0 requirement.

Change

  • GitHub Actions CI (.github/workflows/ci.yml): Adds pre-merge workflow (pull_request / push to main + workflow_dispatch) with 5 checks:
    • checks matrix (Lint, Typecheck with next typegen + tsc + drizzle-kit check, and Unit Tests)
    • test-integration against a postgres:16-alpine service container
    • docker-build dry run (push: false, fork-safe GHA Buildx cache)
  • ESLint migration & warning ceiling (eslint.config.js, package.json): Switches lint to eslint . --max-warnings=270, migrates eslint.config.js to native eslint-config-next/core-web-vitals, ignores coverage/**, removes unused @eslint/eslintrc and dotenv-cli, and temporarily downgrades pre-existing debt/new React 19 Compiler rules to "warn" so CI enforces 0 errors and caps total warnings immediately.
  • Test isolation & safety (vitest.config.ts, src/test/test-env.ts, src/test/test-db.ts, src/test/unit/test-env.test.ts, src/test/integration/coverage-service.test.ts):
    • Splits Vitest into unit (no DB) and integration (sequential with Postgres globalSetup) projects.
    • Replaces tracked .env.test with synthetic defaults in src/test/test-env.ts, .env.test.local overrides, and loopback-only .env retargeting (never inheriting shell DATABASE_URL).
    • Guards resetDatabase() via SELECT current_database() (requiring _test suffix and closing the connection before throwing) and resets pgboss + public.
    • Replaces hardcoded 2026 dates in coverage-service.test.ts with relative future Temporal.PlainDate values and adds unit tests in src/test/unit/test-env.test.ts.
  • Node 26 Active LTS alignment (Dockerfile, package.json, .github/workflows/ci.yml): Aligns CI, Dockerfile (with a shared pnpm-base stage using npm install -g pnpm@10.32.1), @types/node@^26.6.6, and engines.node >=26.

Verification

  • SKIP_ENV_VALIDATION=1 pnpm exec next typegen && pnpm lint — 0 errors, 270 warnings (at ceiling)
  • pnpm typecheck & SKIP_ENV_VALIDATION=1 pnpm exec drizzle-kit check — passed
  • pnpm exec prettier --check on modified/new config & test files — passed
  • TZ=UTC pnpm test:unit — 8/8 files, 59/59 passed
  • TZ=UTC pnpm test:integration — 9/9 files, 119/119 passed (against local neuron_test Postgres)
  • SKIP_ENV_VALIDATION=1 NEXT_TELEMETRY_DISABLED=1 pnpm build (Node v26.13.1) — passed
  • GitHub Actions CI checks (Lint, Typecheck, Unit Tests, Integration Tests, Docker Build (Dry Run)) all passed on PR chore(ci): add pre-merge GitHub Actions CI, ESLint flat config, and test DB hardening #225.

Deployment notes

  • Runtime container base image updates from node:20-alpine to node:26-alpine (Active LTS).
  • After merging, configure a GitHub Ruleset / Branch Protection rule on main requiring the CI status checks (Lint, Typecheck, Unit Tests, Integration Tests, Docker Build (Dry Run)).
  • Local developers overriding test DB credentials can use gitignored .env.test.local or TEST_DATABASE_URL; .env.test has been removed.

@theosiemensrhodes
theosiemensrhodes marked this pull request as draft November 25, 2026 06:26
@theosiemensrhodes
theosiemensrhodes marked this pull request as ready for review November 25, 2026 06:28
@theosiemensrhodes
theosiemensrhodes merged commit 2f2a0a2 into main Nov 25, 2026
5 checks passed
@theosiemensrhodes
theosiemensrhodes deleted the ci/github-actions-draft branch November 25, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant