Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changeset/tiny-lizards-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

Adds a CI smoke test that runs built database migrations against PostgreSQL.
69 changes: 69 additions & 0 deletions .github/workflows/migration-smoke-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Migration Smoke Test

on:
pull_request:
branches: [main]
paths:
- '.github/workflows/migration-smoke-test.yml'
- 'package.json'
- 'package-lock.json'
- 'server/src/db/**'
- 'server/src/config.ts'
- 'server/tsconfig.json'
- 'Dockerfile'
push:
branches: [main]
paths:
- '.github/workflows/migration-smoke-test.yml'
- 'package.json'
- 'package-lock.json'
- 'server/src/db/**'
- 'server/src/config.ts'
- 'server/tsconfig.json'
- 'Dockerfile'

jobs:
migrate:
name: Built migrations against Postgres
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: adcp_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d adcp_test"
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci
env:
PUPPETEER_SKIP_DOWNLOAD: 'true'

- name: Build
run: npm run build

- name: Stage migrations into dist
run: |
mkdir -p dist/db
cp -R server/src/db/migrations dist/db/migrations

- name: Run built migrations
env:
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/adcp_test
run: node dist/db/migrate.js
Loading