name: Pytest Euler
run-name: >
  ${{ github.event_name == 'pull_request' && 'Full Matrix — PR' || 'Minimal Matrix — Push' }}
  ${{ github.event.pull_request.number || github.ref_name }}

on:
  pull_request:
    branches:
      - "*"
    paths:
      - "pyproject.toml"
      - "setup.py"
      - "py_ballisticcalc/**"
      - "tests/**"
      - "py_ballisticcalc.exts/**"
      - ".github/**"

  push:
    branches:
      - "*"
    paths:
      - "pyproject.toml"
      - "setup.py"
      - "py_ballisticcalc/**"
      - "tests/**"
      - "py_ballisticcalc.exts/**"
      - ".github/**"

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  # Job for full matrix, runs ONLY on pull_request events
  test_full_matrix:
    name: Run Full Matrix Tests (Pull Request)
    if: github.event_name == 'pull_request'

    strategy:
      max-parallel: 10
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - ubuntu-24.04-arm
          - windows-latest
          - windows-11-arm
          - macos-15-intel
          - macos-15
        python-version:
          ["3.10", "3.11", "3.12", "3.13", "3.13t", "3.14", "3.14t"]
        engine: ["euler_engine"]

    uses: ./.github/workflows/pytest-reusable.yml
    with:
      os: ${{ matrix.os }}
      python_version: ${{ matrix.python-version }}
      engine_name: ${{ matrix.engine }}

  # Job for minimal matrix, runs ONLY on push events
  test_minimal_matrix:
    name: Run Minimal Matrix Tests (Push)
    if: github.event_name == 'push'

    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest]
        python-version: ["3.10"]
        engine: ["euler_engine"]

    uses: ./.github/workflows/pytest-reusable.yml
    with:
      os: ${{ matrix.os }}
      python_version: ${{ matrix.python-version }}
      engine_name: ${{ matrix.engine }}
