ci: run migrations against Postgres service container in CI
Add a migrate job that applies node-pg-migrate against an ephemeral Postgres 16 service container so broken migrations fail at PR time. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
81bed51369
commit
37d38de7ff
1 changed files with 31 additions and 0 deletions
31
.github/workflows/ci.yml
vendored
31
.github/workflows/ci.yml
vendored
|
|
@ -7,6 +7,7 @@ name: CI
|
||||||
# What this CI covers (and Vercel does not):
|
# What this CI covers (and Vercel does not):
|
||||||
# - Lint (cheap belt-and-suspenders)
|
# - Lint (cheap belt-and-suspenders)
|
||||||
# - Schema-map drift check (docs/SCHEMA_MAP.md updated when scripts/add-*.js changes)
|
# - Schema-map drift check (docs/SCHEMA_MAP.md updated when scripts/add-*.js changes)
|
||||||
|
# - Migrations apply cleanly (node-pg-migrate against ephemeral Postgres 16)
|
||||||
# - Unit tests (vitest)
|
# - Unit tests (vitest)
|
||||||
#
|
#
|
||||||
# NOTE: tcg-vault is JavaScript (not TypeScript). No `npx tsc --noEmit` step.
|
# NOTE: tcg-vault is JavaScript (not TypeScript). No `npx tsc --noEmit` step.
|
||||||
|
|
@ -230,6 +231,36 @@ jobs:
|
||||||
fi
|
fi
|
||||||
echo "OK: no forbidden stale strings in pages/ or components/."
|
echo "OK: no forbidden stale strings in pages/ or components/."
|
||||||
|
|
||||||
|
migrate:
|
||||||
|
name: Migrations apply (node-pg-migrate)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:16
|
||||||
|
env:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: deckhearth_test
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
env:
|
||||||
|
POSTGRES_URL: postgres://postgres:postgres@localhost:5432/deckhearth_test
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: npm
|
||||||
|
- run: npm ci
|
||||||
|
- name: Write migrate env file
|
||||||
|
run: echo "POSTGRES_URL=${POSTGRES_URL}" >> .env.local
|
||||||
|
- run: npm run migrate up
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: Unit tests (vitest)
|
name: Unit tests (vitest)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue