name: Typecheck-typeshed-code

on:
  workflow_dispatch:
  push:
    branches:
      - main
      - master
  pull_request:
    paths:
      - 'scripts/**'
      - 'tests/**'
      - '.github/workflows/typecheck_typeshed_code.yml'
      - 'requirements-tests.txt'

permissions:
  contents: read

env:
  PIP_DISABLE_PIP_VERSION_CHECK: 1

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  mypy:
    name: Run mypy against the scripts and tests directories
    runs-on: ubuntu-latest
    strategy:
      matrix:
        platform: ["linux", "win32"]
      fail-fast: false
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: 3.9
      - run: pip install -r requirements-tests.txt
      - run: python ./tests/typecheck_typeshed.py --platform=${{ matrix.platform }}
