Skip to content

test free-threaded builds #1942

test free-threaded builds

test free-threaded builds #1942

Workflow file for this run

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"]
# free-threaded: [false]
include:
- python-version: "3.13"
architecture: "x64"
free-threaded: true
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
if: ${{ ! matrix.free-threaded }}
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
# Until either the following are available:
# https://github.com/actions/setup-python/issues/771
# https://github.com/astral-sh/uv/issues/7193
- name: Set up Python 3.13t
if: ${{ matrix.free-threaded }}
run: |
$pythonInstallerUrl = "https://www.python.org/ftp/python/3.13.0/python-3.13.0-amd64.exe"
Invoke-WebRequest $pythonInstallerUrl -OutFile setup-python.exe
Start-Process "setup-python.exe" -argumentlist "/quiet PrependPath=1 TargetDir=C:\Python313 Include_freethreaded=1" -wait
C:\Python313\python3.13t.exe -m ensurepip
Set-Content -Path "$PSHOME\Profile.ps1" -Value 'Set-Alias -Name python -Value "C:\Python313\python3.13t.exe"'
Add-Content -Path "$PSHOME\Profile.ps1" -Value 'Set-Alias -Name pip -Value "C:\Python313\Scripts\pip.exe"'
- name: Setup environment
run: |
python --version
pip --version
pip install --upgrade setuptools>=74 wheel
- name: Build and install
run: |
python setup.py install --user
- 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: |
python setup.py bdist_wheel --skip-build
- uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: artifacts
path: |
dist/*.whl
dist/*.exe
# 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"]
# free-threaded: [false]
include:
- python-version: "3.13"
free-threaded: true
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
if: ${{ ! matrix.free-threaded }}
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
# Until either the following are available:
# https://github.com/actions/setup-python/issues/771
# https://github.com/astral-sh/uv/issues/7193
- name: Set up Python 3.13t
if: ${{ matrix.free-threaded }}
run: |
$pythonInstallerUrl = "https://www.python.org/ftp/python/3.13.0/python-3.13.0-amd64.exe"
Invoke-WebRequest $pythonInstallerUrl -OutFile setup-python.exe
Start-Process "setup-python.exe" -argumentlist "/quiet PrependPath=1 TargetDir=C:\Python313 Include_freethreaded=1" -wait
C:\Python313\python3.13t.exe -m ensurepip
Set-Content -Path "$PSHOME\Profile.ps1" -Value 'Set-Alias -Name python -Value "C:\Python313\python3.13t.exe"'
Add-Content -Path "$PSHOME\Profile.ps1" -Value 'Set-Alias -Name pip -Value "C:\Python313\Scripts\pip.exe"'
- name: Setup Environment
run: |
python --version
pip --version
pip install --upgrade setuptools>=74 wheel
- name: Obtain ARM64 library files
run: |
python .github\workflows\download-arm64-libs.py .\arm64libs
- name: Build wheels
run: python setup.py build_ext -L .\arm64libs --plat-name win-arm64 build --plat-name win-arm64 bdist_wheel --plat-name win-arm64
- uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: artifacts
path: |-
dist/*.whl
# # 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 version supported by our checkers
# # (black>=24.10.0 supports Python >=3.9)
# python-version: "3.9"
# cache: pip
# cache-dependency-path: .github/workflows/main.yml
# - run: pip install clang-format pycln
# - run: pycln . --config=pycln.toml --check
# - uses: chartboost/ruff-action@v1
# with:
# version: "0.4.5"
# - uses: psf/black@stable
# with:
# options: "--fast --check --diff --verbose"
# - 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')
# clang-format --Werror --dry-run $(git ls-files '*.h' ':!:Pythonwin/Scintilla/' ':!:com/win32comext/mapi/src/MAPIStubLibrary/')
# shell: powershell
# 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-regex 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.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
# # pyright vendors typeshed, but let's make sure we have the most up to date stubs
# - run: pip install types-regex types-setuptools PyOpenGL
# - uses: jakebailey/pyright-action@v2
# with:
# python-version: ${{ matrix.python-version }}
# version: "1.1.358"
# annotate: errors