name: MyPy

on: [ push, pull_request ]


jobs:
  mypy:
    name: Run MyPy
    runs-on: ubuntu-latest

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

      - uses: reviewdog/action-setup@v1
        with:
          reviewdog_version: latest

      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
          cache: 'pip'

      - name: Install dependencies
        run: |
          python -m pip install --upgrade uv
          uv pip install --system -r requirements.txt
          uv pip install --system mypy==1.11.2
          mkdir tagstudio/.mypy_cache

      - uses: tsuyoshicho/action-mypy@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          reporter: github-check
          fail_on_error: true
          workdir: tagstudio
          level: error
          mypy_flags: --config-file ../pyproject.toml
