name: playwright

on:
  push:
    branches:
      - main
    paths-ignore:
      - "apps/website/**"
  pull_request:

permissions:
  actions: read
  contents: read

jobs:
  main:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
        with:
          filter: tree:0
          fetch-depth: 0

      - uses: pnpm/action-setup@v4
      - uses: actions/setup-node@v6
        with:
          node-version: 22
          cache: 'pnpm'

      - name: Install dependencies
        run: pnpm install --frozen-lockfile
      - run: pnpm exec playwright install --with-deps

      - run: pnpm --filter server-e2e e2e

      - name: Upload test report
        if: failure()
        uses: actions/upload-artifact@v4
        with:
          name: e2e report
          path: apps/server-e2e/test-output
