mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 18:11:16 +01:00
73 lines
2.2 KiB
YAML
73 lines
2.2 KiB
YAML
name: Run mypy
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- "backend/**"
|
|
- ".github/scripts/**.py"
|
|
- "frontend/src/locales/*.py"
|
|
- ".github/workflows/mypy.yml"
|
|
- ".trunk/configs/mypy.ini"
|
|
- pyproject.toml
|
|
- uv.lock
|
|
- .python-version
|
|
push:
|
|
branches:
|
|
- "master"
|
|
paths:
|
|
- "backend/**"
|
|
- ".github/scripts/**.py"
|
|
- "frontend/src/locales/*.py"
|
|
- ".github/workflows/mypy.yml"
|
|
- ".trunk/configs/mypy.ini"
|
|
- pyproject.toml
|
|
- uv.lock
|
|
- .python-version
|
|
|
|
# A new push cancels a PR's superseded run; each master commit keeps its own.
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
mypy:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up the backend
|
|
uses: ./.github/actions/setup-backend
|
|
with:
|
|
sync-args: --extra dev --extra test
|
|
|
|
# mypy revalidates each cached module against its source and options, so
|
|
# any earlier master cache is safe to seed from.
|
|
- name: Restore the mypy cache
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: .mypy_cache
|
|
key: mypy-${{ runner.os }}-${{ github.sha }}
|
|
restore-keys: mypy-${{ runner.os }}-
|
|
|
|
# The scripts import the app from backend/, as they add it to sys.path.
|
|
- name: Type check the backend and the scripts outside it
|
|
env:
|
|
MYPYPATH: backend
|
|
run: |
|
|
uv run mypy --config-file .trunk/configs/mypy.ini backend .github/scripts frontend/src/locales
|
|
|
|
# Only master writes the cache, so a PR can't evict or seed it.
|
|
- name: Save the mypy cache
|
|
if: github.ref == 'refs/heads/master'
|
|
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: .mypy_cache
|
|
key: mypy-${{ runner.os }}-${{ github.sha }}
|