name: CI

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

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.10", "3.11", "3.12"]

    steps:
    - uses: actions/checkout@v3

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

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install ".[dev]"

    - name: Lint with ruff
      run: |
        pip install ruff
        ruff check .

    - name: Test with pytest
      run: |
        pytest

    - name: Upload coverage reports to Codecov
      uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        slug: GalKepler/VoxelOps

    - name: Build documentation
      run: |
        pip install ".[docs]"
        make -C docs html
