name: Tests and checks on push

on:
  pull_request:
  push:
    branches:
      - main

jobs:
  run-checks-and-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: pnpm/action-setup@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version-file: ".nvmrc"
          cache: "pnpm"

      - name: Install dependencies
        run: pnpm install --frozen-lockfile

      - name: Install Playwright browsers
        run: pnpm exec playwright install chromium

      - name: Formatter/Linter
        run: pnpm run biome:check
      - name: Typecheck
        run: pnpm run typecheck
      - name: Unit tests
        run: pnpm run test:unit:browser
      - name: Knip unused check
        run: pnpm run knip
      - name: Check translations jsons
        run: pnpm run check-translation-jsons:no-write
      - name: Check plural key collapse
        run: pnpm run check-plural-collapse
      - name: Check articles
        run: pnpm run check-articles
      - name: Check test DB migrations
        run: pnpm run check-test-db-migrations
