Test enable groups as specified by PR labels (#2357)

* Allow CIBW_ENABLE to control the wheels built in testing

* Set CIBW_ENABLE using PR labels

* Add docs

* Build everything on the main branch

* Add CIBW_ENABLE=all option

This was mostly for use in the `main` building case, because otherwise it's maybe a bit too easy to forget to update this file when adding an enable group

* Remove dead code

* Make unit tests robust to the value of CIBW_ENABLE

* Fix tests that explicitly choose pypy

* Fix test expectation

* Don't expect impossible wheels in expected_wheels

* Simplify logic in expected_wheels

* CircleCI- run with CIBW_ENABLE=all only on the main branch

* Azure pipelines - run with CIBW_ENABLE=all on main branch

* Update gitlab to run CIBW_ENABLE=all on main

* Set CIBW_ENABLE=all on travis - it only runs on main anyway

* Fix job name error on CircleCI

* Fix tests for graalpy

* Update the test configuration to use the label

* Remove duplication of default value. Make it affect sample build too

* Move the action to after deps are installed

* GraalPy workaround for this assumption

* Make unit test resilient to changing CIBW_ENABLE
This commit is contained in:
Joe Rickerby
2025-05-08 12:27:05 +01:00
committed by GitHub
parent edbd234b82
commit 04c9427a20
15 changed files with 204 additions and 82 deletions
+17 -18
View File
@@ -35,36 +35,34 @@ def test_abi3(tmp_path):
project_dir = tmp_path / "project"
limited_api_project.generate(project_dir)
single_python_tag = "cp{}{}".format(*utils.SINGLE_PYTHON_VERSION)
# build the wheels
actual_wheels = utils.cibuildwheel_run(
project_dir,
add_env={
# free_threaded, GraalPy, and PyPy do not have a Py_LIMITED_API equivalent, just build one of those
# also limit the number of builds for test performance reasons
"CIBW_BUILD": f"cp39-* cp310-* pp310-* gp242-* {single_python_tag}-* cp313t-*"
"CIBW_BUILD": "cp39-* cp310-* pp310-* gp242-* cp312-* cp313t-*",
"CIBW_ENABLE": "all",
},
)
# check that the expected wheels are produced
expected_wheels = utils.expected_wheels("spam", "0.1.0")
if utils.platform == "pyodide":
# there's only 1 possible configuration for pyodide, the single_python_tag one
expected_wheels = [
w.replace(f"{single_python_tag}-{single_python_tag}", "cp310-abi3")
for w in expected_wheels
]
# there's only 1 possible configuration for pyodide, cp312
expected_wheels = utils.expected_wheels("spam", "0.1.0", python_abi_tags=["cp310-abi3"])
else:
expected_wheels = [
w.replace("cp310-cp310", "cp310-abi3")
for w in expected_wheels
if "-cp39" in w
or "-cp310" in w
or "-pp310" in w
or "-graalpy242" in w
or "-cp313t" in w
]
expected_wheels = utils.expected_wheels(
"spam",
"0.1.0",
python_abi_tags=[
"cp39-cp39",
"cp310-abi3", # <-- ABI3, works with 3.10 and 3.12
"cp313-cp313t",
"pp310-pypy310_pp73",
"graalpy311-graalpy242_311_native",
],
)
assert set(actual_wheels) == set(expected_wheels)
@@ -187,6 +185,7 @@ def test_abi_none(tmp_path, capfd):
"CIBW_TEST_COMMAND": f"{utils.invoke_pytest()} ./test",
# limit the number of builds for test performance reasons
"CIBW_BUILD": "cp38-* cp{}{}-* cp313t-* pp310-*".format(*utils.SINGLE_PYTHON_VERSION),
"CIBW_ENABLE": "all",
},
)