jobs:
  changes:
    outputs:
      python: '${{ steps.filter.outputs.python }}'
    runs-on: 'ubuntu-latest'
    steps:
      - uses: 'actions/checkout@v6'
      - id: 'filter'
        uses: 'dorny/paths-filter@v4'
        with:
          filters: |
            python:
              - '**/*.py'
              - '**/*.pyi'
              - '**/*.toml'
  qa:
    needs: 'changes'
    runs-on: 'ubuntu-latest'
    steps:
      - uses: 'actions/checkout@v6'
      - if: "needs.changes.outputs.python == 'true'"
        name: 'Install uv'
        uses: 'astral-sh/setup-uv@v7'
      - if: "needs.changes.outputs.python == 'true'"
        name: 'Set up Python ${{ matrix.python-version }}'
        uses: 'actions/setup-python@v6'
        with:
          python-version: '${{ matrix.python-version }}'
      - if: "needs.changes.outputs.python == 'true'"
        name: 'Install dependencies (uv)'
        run: 'uv sync --group dev --group tests --all-extras'
      - name: 'Yarn cache'
        uses: 'actions/cache@v5'
        with:
          key: "${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}"
          path: '~/.yarn/berry'
          restore-keys: '${ runner.os }}-yarn'
      - name: 'Install dependencies (Yarn)'
        run: 'yarn'
      - continue-on-error: true
        id: 'ruff'
        if: "needs.changes.outputs.python == 'true'"
        name: 'Lint with Ruff'
        uses: 'astral-sh/ruff-action@v3'
      - continue-on-error: true
        id: 'mypy'
        if: "needs.changes.outputs.python == 'true'"
        name: 'Lint with mypy'
        run: 'yarn mypy .'
      - continue-on-error: true
        id: 'prettier'
        name: 'Check formatting (Prettier)'
        run: 'yarn prettier -c .'
      - continue-on-error: true
        id: 'yapf'
        if: "needs.changes.outputs.python == 'true'"
        name: 'Check formatting (YAPF)'
        run: 'uv run yapf -prd .'
      - continue-on-error: true
        id: 'markdownlint'
        name: 'Check formatting (markdownlint)'
        run: 'yarn markdownlint-cli2 --config package.json --configPointer /markdownlint-cli2'
      - continue-on-error: true
        id: 'spelling'
        name: 'Check spelling'
        run: 'yarn check-spelling'
      - if: 'always()'
        name: 'Check results'
        run: |
          ([ "${{ needs.changes.outputs.python }}" != "true" ] || [ "${{ steps.ruff.outcome }}" = "success" ]) &&
          ([ "${{ needs.changes.outputs.python }}" != "true" ] || [ "${{ steps.mypy.outcome }}" = "success" ]) &&
          ([ "${{ needs.changes.outputs.python }}" != "true" ] || [ "${{ steps.yapf.outcome }}" = "success" ]) &&
          [ "${{ steps.prettier.outcome }}" = "success" ] &&
          [ "${{ steps.markdownlint.outcome }}" = "success" ] &&
          [ "${{ steps.spelling.outcome }}" = "success" ]
    strategy:
      matrix:
        python-version:
          - '3.10'
          - '3.11'
          - '3.12'
          - '3.13'
          - '3.14'
name: 'QA'
'on':
  pull_request:
    branches:
      - 'master'
  push:
    branches:
      - 'master'
permissions:
  contents: 'read'
