---
# PR/push E2E gate.
#
# Calls the reusable `e2e-reusable.yml` with Linux only (smoke + mega-flow).
# macOS / Windows E2E only runs at release time — see release-staging.yml
# and release-production.yml `pretest` jobs which call the same reusable
# workflow with `run_macos`, `run_windows`, and `full` all true.
#
# `workflow_dispatch` lets an operator opt in to a full-suite all-OS run
# without cutting a release tag.
name: E2E

on:
  push:
    branches: [main]
  pull_request:
  workflow_dispatch:
    inputs:
      run_macos:
        description: Also run the macOS E2E job.
        type: boolean
        default: false
      run_windows:
        description: Also run the Windows E2E job.
        type: boolean
        default: false
      full:
        description: Run the entire spec suite (slow; ~30+ min per OS).
        type: boolean
        default: false

permissions:
  contents: read
  pull-requests: read

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref || github.ref }}
  cancel-in-progress: true

jobs:
  e2e:
    uses: ./.github/workflows/e2e-reusable.yml
    with:
      run_linux: true
      run_macos: ${{ github.event_name == 'workflow_dispatch' && inputs.run_macos }}
      run_windows: ${{ github.event_name == 'workflow_dispatch' && inputs.run_windows }}
      full: ${{ github.event_name == 'workflow_dispatch' && inputs.full }}
