forked from orinoco/things-enrichment-tools
This is presently not possible for the cases where we need more flexibility (e.g. fetch-depth=0). But this plan is to make that possible.
37 lines
1.5 KiB
YAML
37 lines
1.5 KiB
YAML
name: Type annotation (PR)
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'things_enrichment_tools/**.py'
|
|
- '!**/tests/**.py'
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: debian-latest
|
|
steps:
|
|
- name: Checkout project
|
|
uses: https://hub.psychoinformatics.de/actions/checkout-action@v1
|
|
- 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
|
|
hatch run types:mypy --install-types --non-interactive --follow-imports skip ${{ steps.changed-py-files.outputs.all_changed_files }}
|
|
# 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 --python-version 3.12 --follow-imports skip --pretty --show-error-context ${{ steps.changed-py-files.outputs.all_changed_files }}
|