name: test

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

jobs:
  test:
    name: ${{ matrix.os }} ${{ matrix.python-version }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9"]

    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}
          cache: pip
          cache-dependency-path: pyproject.toml
      - name: install dev dependencies
        run: python -m pip install --upgrade pip hatch
      - name: run tests
        run: hatch run test:cov
