Typecheck #770
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Typecheck | |
on: | |
push: | |
branches: main | |
paths-ignore: | |
- "**.json" | |
- "**.md" | |
- "**.csv" | |
- "**.html" | |
pull_request: | |
paths-ignore: | |
- "**.json" | |
- "**.md" | |
- "**.csv" | |
- "**.html" | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
permissions: | |
contents: read | |
env: | |
FORCE_COLOR: 1 # Request colored output from CLI tools supporting it | |
TERM: xterm-256color # needed for FORCE_COLOR to work on mypy on Ubuntu, see https://github.com/python/mypy/issues/13817 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
mypy: | |
name: Check code with mypy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- run: uv run --python=3.11 --extra=typecheck mypy | |
pyright: | |
name: Run pyright on the codebase | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- uses: hynek/setup-cached-uv@v2 | |
- run: uv pip install -e ".[typecheck]" --system | |
- run: uv pip freeze | |
- name: Run pyright | |
uses: jakebailey/pyright-action@v2 | |
with: | |
version: "1.1.331" | |
create-issue-on-failure: | |
name: Create an issue if daily typecheck failed | |
runs-on: ubuntu-latest | |
needs: [mypy, pyright] | |
if: >- | |
${{ | |
github.repository == 'AlexWaygood/typeshed-stats' | |
&& always() | |
&& github.event_name == 'schedule' | |
&& ( | |
needs.mypy.result == 'failure' | |
|| needs.pyright.result == 'failure' | |
) | |
}} | |
permissions: | |
issues: write | |
steps: | |
- uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
await github.rest.issues.create({ | |
owner: "AlexWaygood", | |
repo: "typeshed-stats", | |
title: `Daily typecheck failed on ${new Date().toDateString()}`, | |
body: "Runs are listed here: https://github.com/AlexWaygood/typeshed-stats/actions/workflows/typecheck.yml", | |
}) |