name: CI on: push: branches: [master] pull_request: branches: [master] jobs: build-and-test: runs-on: ubuntu-latest services: postgres: image: postgres:16-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 - uses: pnpm/action-setup@v4 with: version: 9 - uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - run: pnpm install --frozen-lockfile - name: Generate Prisma client run: cd apps/api && npx prisma generate - name: Build shared package run: pnpm --filter @kooltap/shared run build - name: TypeScript check run: pnpm typecheck # Uses the still-empty database as shadow database, so it must run before the migrations - name: Check schema matches migrations run: cd apps/api && npx prisma migrate diff --from-migrations prisma/migrations --to-schema-datamodel prisma/schema.prisma --shadow-database-url "$DATABASE_URL" --exit-code - name: Apply migrations run: cd apps/api && npx prisma migrate deploy - name: Unit tests run: pnpm test - name: E2E tests run: pnpm test:e2e - name: Build run: pnpm build