name: CI

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

jobs:
  checks:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "{{ python_version }}"

      - name: Install project
        run: |
          python -m pip install --upgrade pip
          pip install -e .{% if include_ruff or include_mypy or include_pytest %}[dev]{% endif %}

      - name: Run checks
        run: |
{% if include_ruff -%}
          python -m ruff check .
{% endif -%}
{% if include_mypy -%}
          python -m mypy .
{% endif -%}
{% if include_pytest -%}
          python -m pytest
{% endif -%}
{% if not include_ruff and not include_mypy and not include_pytest -%}
          echo "No extra quality tooling is enabled for the {{ preset_name }} preset."
{% endif %}
