name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - run: npm ci
      - run: npx prisma generate
      - run: npx tsc --noEmit
      - run: npm run lint
      - run: npm run build
        env:
          NEXTAUTH_SECRET: ci-test-secret
          NEXTAUTH_URL: http://localhost:3000
          DATABASE_URL: postgresql://dummy:dummy@localhost:5432/dummy
          ENCRYPTION_KEY: ci-test-encryption-key-32-bytes!!
