name: 13. _Test Suite (Full)

on:
  workflow_call:
    inputs:
      os_json:
        description: 'JSON string of OS to run on'
        required: false
        type: string
        default: '["ubuntu-24.04", "macos-14", "windows-latest"]'
      python_json:
        description: 'JSON string of Python versions'
        required: false
        type: string
        default: '["3.10", "3.11", "3.12", "3.13"]'
  workflow_dispatch:
    inputs:
      os_json:
        description: 'JSON string of OS to run on'
        required: false
        default: '["ubuntu-24.04", "macos-14", "windows-latest"]'
      python_json:
        description: 'JSON string of Python versions'
        required: false
        default: '["3.10", "3.11", "3.12", "3.13"]'

jobs:
  test:
    name: Full Test (${{ matrix.os }}, ${{ matrix.python-version }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: ${{ fromJson(inputs.os_json || '["ubuntu-24.04", "macos-14", "windows-latest"]') }}
        python-version: ${{ fromJson(inputs.python_json || '["3.10", "3.11", "3.12", "3.13"]') }}

    steps:
    - uses: actions/checkout@v6
      with:
        submodules: recursive

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v6
      with:
        python-version: ${{ matrix.python-version }}

    - name: Set up Go
      uses: actions/setup-go@v6
      with:
        go-version: '1.25.1'

    - name: Install uv
      uses: astral-sh/setup-uv@v7
      with:
        enable-cache: true

    - name: Install system dependencies (Ubuntu)
      if: runner.os == 'Linux'
      run: |
        sudo apt-get update
        sudo apt-get install -y cmake build-essential

    - name: Install system dependencies (macOS)
      if: runner.os == 'macOS'
      run: brew install cmake

    - name: Install system dependencies (Windows)
      if: runner.os == 'Windows'
      run: |
        choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
        choco install mingw

    - name: Add MinGW to PATH (Windows)
      if: runner.os == 'Windows'
      run: echo "C:\mingw64\bin" >> $env:GITHUB_PATH

    - name: Install Python dependencies
      run: uv sync --frozen --extra test

    - name: Install build dependencies
      run: uv pip install setuptools setuptools_scm cmake wheel

    - name: Build C++ extensions
      run: uv run python setup.py build_ext --inplace

    # TODO: Once unit tests are fixed, switch this back to running the full test suite
    # run: uv run pytest tests/ -v --cov=openviking --cov-report=term
    - name: Run Lite Integration Test (Temporary Replacement)
      shell: bash
      run: |
        export PYTHONPATH=$PYTHONPATH:$(pwd)
        uv run python tests/integration/test_quick_start_lite.py
