name: Test Simple

on: [workflow_dispatch]

jobs:
  build_and_test:
    name: "${{ matrix.os }} + python ${{ matrix.python-version }}"
    runs-on: "${{ matrix.os }}"
    strategy:
      fail-fast: false
      matrix:
        os: ["windows-latest", "ubuntu-latest", "macos-13"]
        python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install requirements
        run: |
          python -m pip install --upgrade pip
          pip install "setuptools>=67.2.0"
          pip install wheel build
      - name: Test build from source
        run: python -m build --wheel
      - name: Test direct install from GitHub main
        run: pip install git+https://github.com/gatagat/lap.git
      - name: 🧪 Run test_simple.py
        run: |
          cd lap/tests/
          python test_simple.py
      - name: Archive wheels
        uses: actions/upload-artifact@v4
        with:
          name: wheel-${{ matrix.os }}-${{ matrix.python-version }}
          path: dist/*.whl
