name: Tests

on:
  push:
    branches:
      - main

jobs:
  test:
    name: Test on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}

    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        exclude: [os: macos-latest]

    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Install Qt dependencies
        uses: iTaxoTools/itt-common/.github/actions/test-qt@main

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: 3.x

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

      - name: Lint with pre-commit
        uses: pre-commit/action@v3.0.0

      - name: Test with pytest
        run: |
          pip install pytest pytest-qt pytest-xvfb
          pytest
