name: build

on: [push, pull_request, workflow_dispatch]

jobs:
  build:

    runs-on: ${{ matrix.os }}

    strategy:
      fail-fast: false
      matrix:
        python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
        os: [ubuntu-latest, windows-latest]

    steps:
    - uses: actions/checkout@v4
    - name: Set up Python
      uses: actions/setup-python@v5
      with:
        python-version: ${{ matrix.python }}
        allow-prereleases: true
    - name: Install hatch
      run: python -m pip install --upgrade pip hatch hatch-vcs
    - name: Run tests
      run: hatch run +py=${{ matrix.python }} test:default --color=yes

  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-python@v5
      with:
        python-version: 3.x
    - uses: pre-commit/action@v3.0.1
