name: e2e-tests

on:
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  files-changed:
    uses: ./.github/workflows/files-changed.yml

  test-e2e:
    if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.e2e == 'true'
    needs: files-changed
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
      - uses: ./.github/actions/go-setup
      - uses: ./.github/actions/node-setup
      - run: make deps-frontend
      - run: make frontend
      - run: make deps-backend
      - run: make backend
        env:
          TAGS: bindata
      - run: make playwright
      - run: make test-e2e
        timeout-minutes: 10
        env:
          TAGS: bindata
          FORCE_COLOR: 1
          GITEA_TEST_E2E_DEBUG: 1
