Files
brammie15 314717ba3a
CI / build-and-test (push) Canceled after 0s
feat: move to V2
2026-10-29 11:21:52 +01:00

72 lines
1.7 KiB
YAML

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_DB: kooltap
POSTGRES_USER: kooltap
POSTGRES_PASSWORD: kooltap
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U kooltap"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
DATABASE_URL: postgresql://kooltap:kooltap@localhost:5432/kooltap
JWT_SECRET: ci-secret
steps:
- uses: actions/checkout@v4
# The version comes from packageManager in package.json
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
# Also generates the Prisma client
- run: pnpm install --frozen-lockfile
- name: Build shared package
run: pnpm --filter @kooltap/shared run build
- name: Typecheck
run: pnpm typecheck
# Uses the still-empty database as shadow database, so it must run before the migrations
- name: Check schema matches migrations
working-directory: apps/api
run: SHADOW_DATABASE_URL="$DATABASE_URL" npx prisma migrate diff --from-migrations prisma/migrations --to-schema prisma/schema.prisma --exit-code
- name: Apply migrations
working-directory: apps/api
run: npx prisma migrate deploy
- name: Unit tests
run: pnpm test
- name: End-to-end tests
run: pnpm test:e2e
- name: Build
run: pnpm build
- name: Terminal protocol JSON Schema
run: pnpm --filter @kooltap/shared run schema