dump-things-service/.forgejo/workflows/mypy-pr.yml
Michael Hanke b9157d5de2
Some checks failed
Codespell / Check for spelling errors (push) Successful in 41s
Codespell / Check for spelling errors (pull_request) Successful in 43s
Ruff / Code linting (pull_request) Failing after 51s
Ruff / Code linting (push) Failing after 51s
Type annotation (PR) / check (pull_request) Successful in 1m20s
Test execution / Test-all (push) Successful in 1m31s
ci: add workflow to check typing in files changed in a given PR
Right now, it makes no sense to type-check the entire project due to the
large number of issues. This is an alternative approach that should help
improve the situation over time.
2026-06-30 20:18:42 +02:00

36 lines
1.3 KiB
YAML

name: Type annotation (PR)
on:
pull_request:
paths:
- 'dump_things_service/**.py'
- '!**/tests/**.py'
jobs:
check:
runs-on: debian-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Install hatch
run: uv tool install hatch
- name: Get Python changed files
id: changed-py-files
uses: https://github.com/tj-actions/changed-files@v46
with:
files: |
*.py
**/*.py
- name: Type check changed files
if: steps.changed-py-files.outputs.any_changed == 'true'
run: |
# get any type stubs that mypy thinks it needs
# run mypy on the modified files only, and do not even follow imports.
# this results is a fairly superficial test, but given the overall
# state of annotations, we strive to become more correct incrementally
# with focused error reports, rather than barfing a huge complaint
# that is unrelated to the changeset someone has been working on.
# run on the oldest supported Python version
hatch run types:mypy --install-types --non-interactive --python-version 3.11 --follow-imports skip --pretty --show-error-context ${{ steps.changed-py-files.outputs.all_changed_files }}