Add annotations to typecheck demos
modules with mypy
#2255
Workflow file for this run
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: CI | |
on: | |
push: | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: Build and test | |
runs-on: windows-2019 | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
architecture: ["x64", "x86"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.architecture }} | |
cache: pip | |
cache-dependency-path: .github/workflows/main.yml | |
check-latest: true | |
- name: Setup environment | |
run: | | |
python --version | |
pip --version | |
pip install --upgrade setuptools>=74 wheel | |
- name: Build and install | |
run: pip install . -v --user | |
# This needs to happen *after* installing pywin32 since | |
# AutoDuck/py2d.py currently relies on runtime imports for introspection | |
# This isn't included in the wheel (TODO: could we?) | |
# and only servces as a PR test for the docs.yaml workflow | |
- name: Generate PyWin32.chm help file | |
run: python AutoDuck/make.py | |
- name: Run tests | |
# Run the tests directly from the source dir so support files (eg, .wav files etc) | |
# can be found - they aren't installed into the Python tree. | |
run: python pywin32_testall.py -v -skip-adodbapi | |
- name: Build wheels | |
run: pip wheel . -v --wheel-dir=dist | |
- uses: actions/upload-artifact@v3 | |
# Upload artifacts even if tests fail | |
if: ${{ always() }} | |
with: | |
name: artifacts | |
path: dist/*.whl | |
if-no-files-found: error | |
# We cannot build and test on ARM64, so we cross-compile. | |
# Later, when available, we can add tests using this wheel on ARM64 VMs | |
build_arm64: | |
name: Cross-compile ARM | |
runs-on: windows-2019 | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: "x64" | |
cache: pip | |
cache-dependency-path: .github/workflows/main.yml | |
check-latest: true | |
- name: Setup Environment | |
run: | | |
python --version | |
pip --version | |
pip install --upgrade setuptools>=74 wheel build | |
- name: Obtain ARM64 library files | |
run: python .github\workflows\download-arm64-libs.py .\arm64libs | |
- name: Build wheels | |
run: python -m build --wheel --config-setting=--build-option=build_ext --config-setting=--build-option=-L.\arm64libs --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=build --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=bdist_wheel --config-setting=--build-option=--plat-name=win-arm64 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts | |
path: dist/*.whl | |
if-no-files-found: error | |
# This job can be run locally by running `pre-commit run` | |
checkers: | |
runs-on: windows-2019 | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
# This job only needs to target the oldest supported version | |
python-version: "3.8" | |
cache: pip | |
cache-dependency-path: .github/workflows/main.yml | |
- run: pip install clang-format==18.1.* pycln | |
- run: pycln . --config=pycln.toml --check | |
- uses: astral-sh/ruff-action@v2 | |
with: | |
version: "0.8.2" | |
- run: ruff format --check | |
- run: | |
| # Too many files to fit in a single command, also exclude vendored Scintilla and MAPIStubLibrary | |
clang-format --Werror --dry-run $(git ls-files '*.cpp' ':!:com/win32comext/mapi/src/MAPIStubLibrary/') | |
if ($LastExitCode -ne 0) { exit $LastExitCode } | |
clang-format --Werror --dry-run $(git ls-files '*.h' ':!:Pythonwin/Scintilla/' ':!:com/win32comext/mapi/src/MAPIStubLibrary/') | |
if ($LastExitCode -ne 0) { exit $LastExitCode } | |
mypy: | |
runs-on: windows-2019 | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
cache-dependency-path: .github/workflows/main.yml | |
check-latest: true | |
- run: pip install types-setuptools PyOpenGL mypy==1.11 | |
- run: mypy . --python-version=${{ matrix.python-version }} | |
pyright: | |
runs-on: windows-2019 | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
cache-dependency-path: .github/workflows/main.yml | |
check-latest: true | |
# pyright vendors typeshed, but let's make sure we have the most up to date stubs | |
- run: pip install types-setuptools PyOpenGL | |
- uses: jakebailey/pyright-action@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
version: "1.1.358" | |
annotate: errors |