name: CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["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 dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -e ".[all]"
        pip install pytest pytest-cov ruff mypy pandas-stubs
    - name: Lint with ruff
      run: |
        ruff check src tests benchmarks
        ruff format --check src tests benchmarks
    - name: Type check with mypy
      run: |
        mypy src tests
    - name: Run tests
      run: |
        PYTHONPATH=src pytest --cov=lodum --cov-report=term-missing --ignore=tests/test_numpy.py --ignore=tests/test_pandas.py --ignore=tests/test_polars.py

  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python
      uses: actions/setup-python@v5
      with:
        python-version: "3.10"
    - name: Install build tool
      run: python -m pip install build
    - name: Build package
      run: python -m build
