ci: Add a cibuildwheel test run to test.yml and allow free-threaded builds #575
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
# The "test" workflow is run on every PR and runs tests across all | |
# supported python versions and a range of configurations | |
# specified in tox.ini. Also see the "build" workflow which is only | |
# run for release branches and covers platforms other than linux-amd64 | |
# (Platform-specific issues are rare these days so we don't want to | |
# take that time on every build). | |
name: Test | |
on: pull_request | |
permissions: {} | |
jobs: | |
# Before starting the full build matrix, run one test configuration | |
# and the linter (the `black` linter is especially likely to catch | |
# first-time contributors). | |
test_quick: | |
name: Run quick tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
# Lint python version must be synced with tox.ini | |
python-version: '3.11' | |
- name: Install tox | |
run: python -m pip install tox -c requirements.txt | |
- name: Run test suite | |
run: python -m tox -e py311,lint | |
test_tox: | |
name: Run full tests | |
needs: test_quick | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
include: | |
- python: '3.9' | |
tox_env: py39-full | |
- python: '3.10' | |
tox_env: py310-full | |
- python: '3.10.8' | |
# Early versions of 3.10 and 3.11 had different deprecation | |
# warnings in asyncio. Test with them too to make sure everything | |
# works the same way. | |
tox_env: py310-full | |
- python: '3.11' | |
tox_env: py311-full | |
- python: '3.11.0' | |
tox_env: py311-full | |
- python: '3.12' | |
tox_env: py312-full | |
- python: '3.13' | |
tox_env: py313-full | |
- python: '3.14.0-alpha.4' | |
# TODO: Alpha 5 has a bug that affects us, so stick with alpha 4 until 6 is released. | |
# https://github.com/python/cpython/issues/130380 | |
tox_env: py314-full | |
- python: 'pypy-3.10' | |
# Pypy is a lot slower due to jit warmup costs, so don't run the | |
# "full" test config there. | |
tox_env: pypy3 | |
- python: '3.11' | |
# Docs python version must be synced with tox.ini | |
tox_env: docs | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: ${{ matrix.python}} | |
- name: Install apt packages | |
run: sudo apt-get update && sudo apt-get install libcurl4-openssl-dev | |
- name: Install tox | |
run: python -m pip install tox -c requirements.txt | |
- name: Run test suite | |
run: python -m tox -e ${{ matrix.tox_env }} | |
test_win: | |
# Windows tests are fairly slow, so only run one configuration here. | |
# We test on windows but not mac because even though mac is a more | |
# fully-supported platform, it's similar enough to linux that we | |
# don't generally need to test it separately. Windows is different | |
# enough that we'll break it if we don't test it in CI. | |
name: Run windows tests | |
needs: test_quick | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: '3.11' | |
- name: Run test suite | |
# TODO: figure out what's up with these log messages | |
run: py -m tornado.test --fail-if-logs=false | |
zizmor: | |
name: Analyze action configs with zizmor | |
runs-on: ubuntu-22.04 | |
needs: test_quick | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: astral-sh/setup-uv@v5 | |
name: Install uv | |
- name: Run zizmor | |
run: uvx zizmor .github/workflows | |
test_cibw: | |
# cibuildwheel is the tool that we use for release builds in build.yml. | |
# Run it in the every-PR workflow because it's slightly different from our | |
# regular build and this gives us easier ways to test freethreading changes. | |
# | |
# Note that test_cibw and test_tox both take about a minute to run, but test_tox runs | |
# more tests; test_cibw spends a lot of its time installing dependencies. Replacing | |
# test_tox with test_cibw would entail either increasing test runtime or reducing | |
# test coverage. | |
name: Test with cibuildwheel | |
runs-on: ubuntu-22.04 | |
needs: test_quick | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Run cibuildwheel | |
uses: pypa/cibuildwheel@v2.22 | |
env: | |
# For speed, we only build one python version and one arch. We throw away the wheels | |
# built here; the real build is defined in build.yml. | |
CIBW_ARCHS: native | |
CIBW_BUILD: cp313-manylinux* | |
# Alternatively, uncomment the following lines (and replace the previous CIBW_BUILD) | |
# to test a freethreading build of python. | |
#CIBW_BUILD: cp313t-manylinux* | |
#CIBW_ENABLE: cpython-freethreading | |
# I don't understand what this does but auditwheel seems to fail in this configuration. | |
# Since we're throwing away the wheels here, just skip it. | |
# TODO: When we no longer need to disable this, we can enable freethreading in | |
# build.yml. | |
#CIBW_REPAIR_WHEEL_COMMAND: "" |