Skip to content

Typecheck

Typecheck #765

Workflow file for this run

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",
})