Skip to content

Commit cd56888

Browse files
rwgkhenryiii
andauthored
Bring CI back to all-working condition (#5822)
* Fix "🐍 3 • windows-latest • mingw64" job (apparently msys2/setup-msys2@v2 cannot be run twice anymore): https://github.com/pybind/pybind11/actions/runs/17394902023/job/49417376616?pr=5796 ``` Run msys2/setup-msys2@v2 with: msystem: mingw64 install: mingw-w64-x86_64-python-numpy mingw-w64-x86_64-python-scipy mingw-w64-x86_64-eigen3 path-type: minimal update: false pacboy: false release: true location: RUNNER_TEMP platform-check-severity: fatal cache: true env: PYTHONDEVMODE: 1 PIP_BREAK_SYSTEM_PACKAGES: 1 PIP_ONLY_BINARY: numpy FORCE_COLOR: 3 PYTEST_TIMEOUT: 300 VERBOSE: 1 CMAKE_COLOR_DIAGNOSTICS: 1 MSYSTEM: MINGW64 Error: Trying to install MSYS2 to D:\a\_temp\msys64 but that already exists, cannot continue. ``` * Add `pytest.xfail("[TEST-GIL-SCOPED] macOS free-threading...)` * Change env.SYS_IS_GIL_ENABLED constant to env.sys_is_gil_enabled function * Change install_mingw64_only → extra_install * Also xfail if macOS and PY_GIL_DISABLED, show SOABI * build-ios: brew upgrade|install cmake * Revert "build-ios: brew upgrade|install cmake" This reverts commit bd3900e. See also: #5822 (comment) * Disable build-ios job in tests-cibw.yml * Remove macos_brew_install_llvm job because it started failing, to reduce our maintenance overhead: Failures tracked here: #5822 (comment) * Fix iOS build step for cmake installation Replaced brew upgrade with brew install for cmake. * Update cmake installation steps in CI workflow Uninstall cmake before installing the latest version due to GitHub's local tap changes. * Update .github/workflows/tests-cibw.yml --------- Co-authored-by: Henry Schreiner <[email protected]>
1 parent 3878c23 commit cd56888

File tree

5 files changed

+25
-103
lines changed

5 files changed

+25
-103
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,8 +1019,15 @@ jobs:
10191019
fail-fast: false
10201020
matrix:
10211021
include:
1022-
- { sys: mingw64, env: x86_64 }
1023-
- { sys: mingw32, env: i686 }
1022+
- sys: mingw32
1023+
env: i686
1024+
extra_install: ""
1025+
- sys: mingw64
1026+
env: x86_64
1027+
extra_install: |
1028+
mingw-w64-x86_64-python-numpy
1029+
mingw-w64-x86_64-python-scipy
1030+
mingw-w64-x86_64-eigen3
10241031
steps:
10251032
- uses: msys2/setup-msys2@v2
10261033
with:
@@ -1034,15 +1041,7 @@ jobs:
10341041
mingw-w64-${{matrix.env}}-python-pytest
10351042
mingw-w64-${{matrix.env}}-boost
10361043
mingw-w64-${{matrix.env}}-catch
1037-
1038-
- uses: msys2/setup-msys2@v2
1039-
if: matrix.sys == 'mingw64'
1040-
with:
1041-
msystem: ${{matrix.sys}}
1042-
install: >-
1043-
mingw-w64-${{matrix.env}}-python-numpy
1044-
mingw-w64-${{matrix.env}}-python-scipy
1045-
mingw-w64-${{matrix.env}}-eigen3
1044+
${{ matrix.extra_install }}
10461045
10471046
- uses: actions/checkout@v4
10481047

@@ -1189,91 +1188,3 @@ jobs:
11891188

11901189
- name: Clean directory
11911190
run: git clean -fdx
1192-
1193-
macos_brew_install_llvm:
1194-
if: github.event.pull_request.draft == false
1195-
name: "macos-13 • brew install llvm"
1196-
runs-on: macos-13
1197-
1198-
env:
1199-
# https://apple.stackexchange.com/questions/227026/how-to-install-recent-clang-with-homebrew
1200-
LDFLAGS: '-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib'
1201-
1202-
steps:
1203-
- name: Update PATH
1204-
run: echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
1205-
1206-
- name: Show env
1207-
run: env
1208-
1209-
- name: Checkout
1210-
uses: actions/checkout@v4
1211-
1212-
- name: Show Clang++ version before brew install llvm
1213-
run: clang++ --version
1214-
1215-
- name: brew install llvm
1216-
run: brew install llvm
1217-
1218-
- name: Show Clang++ version after brew install llvm
1219-
run: clang++ --version
1220-
1221-
- name: Update CMake
1222-
uses: jwlawson/[email protected]
1223-
1224-
- name: Run pip installs
1225-
run: |
1226-
python3 -m pip install --upgrade pip
1227-
python3 -m pip install -r tests/requirements.txt
1228-
python3 -m pip install numpy
1229-
python3 -m pip install scipy
1230-
1231-
- name: Show CMake version
1232-
run: cmake --version
1233-
1234-
- name: CMake Configure
1235-
run: >
1236-
cmake -S . -B .
1237-
-DPYBIND11_WERROR=ON
1238-
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
1239-
-DDOWNLOAD_CATCH=ON
1240-
-DDOWNLOAD_EIGEN=ON
1241-
-DCMAKE_CXX_COMPILER=clang++
1242-
-DCMAKE_CXX_STANDARD=17
1243-
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
1244-
1245-
- name: Build
1246-
run: cmake --build . -j 2
1247-
1248-
- name: Python tests
1249-
run: cmake --build . --target pytest -j 2
1250-
1251-
- name: C++ tests
1252-
run: cmake --build . --target cpptest -j 2
1253-
1254-
- name: Interface test
1255-
run: cmake --build . --target test_cmake_build -j 2
1256-
1257-
- name: Visibility test
1258-
run: cmake --build . --target test_cross_module_rtti -j 2
1259-
1260-
- name: CMake Configure - Exercise cmake -DPYBIND11_TEST_OVERRIDE
1261-
run: >
1262-
cmake -S . -B build_partial
1263-
-DPYBIND11_WERROR=ON
1264-
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
1265-
-DDOWNLOAD_CATCH=ON
1266-
-DDOWNLOAD_EIGEN=ON
1267-
-DCMAKE_CXX_COMPILER=clang++
1268-
-DCMAKE_CXX_STANDARD=17
1269-
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
1270-
"-DPYBIND11_TEST_OVERRIDE=test_call_policies.cpp;test_gil_scoped.cpp;test_thread.cpp"
1271-
1272-
- name: Build - Exercise cmake -DPYBIND11_TEST_OVERRIDE
1273-
run: cmake --build build_partial -j 2
1274-
1275-
- name: Python tests - Exercise cmake -DPYBIND11_TEST_OVERRIDE
1276-
run: cmake --build build_partial --target pytest -j 2
1277-
1278-
- name: Clean directory
1279-
run: git clean -fdx

.github/workflows/tests-cibw.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ jobs:
4242
submodules: true
4343
fetch-depth: 0
4444

45-
- run: brew upgrade cmake
45+
# We have to uninstall first because GH is now using a local tap to build cmake<4, iOS needs cmake>=4
46+
- run: brew uninstall cmake && brew install cmake
4647

4748
- uses: pypa/[email protected]
4849
env:

tests/env.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
sys.modules["__graalpython__"].get_graalvm_version() if GRAALPY else "0.0.0"
1919
)
2020
GRAALPY_VERSION = tuple(int(t) for t in _graalpy_version.split("-")[0].split(".")[:3])
21+
22+
# Compile-time config (what the binary was built for)
2123
PY_GIL_DISABLED = bool(sysconfig.get_config_var("Py_GIL_DISABLED"))
24+
# Runtime state (what's actually happening now)
25+
sys_is_gil_enabled = getattr(sys, "_is_gil_enabled", lambda: True)
2226

2327

2428
def deprecated_call():

tests/test_cpp_conduit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
def import_warns_freethreaded(name):
15-
if name not in sys.modules and not getattr(sys, "_is_gil_enabled", lambda: True)():
15+
if name not in sys.modules and not env.sys_is_gil_enabled():
1616
with pytest.warns(
1717
RuntimeWarning, match=f"has been enabled to load module '{name}'"
1818
):

tests/test_gil_scoped.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,14 @@ def _run_in_process(target, *args, **kwargs):
199199
if process.exitcode is None:
200200
assert t_delta > 0.9 * timeout
201201
msg = "DEADLOCK, most likely, exactly what this test is meant to detect."
202-
if env.PYPY and env.WIN:
203-
pytest.skip(msg)
202+
soabi = sysconfig.get_config_var("SOABI")
203+
if env.WIN and env.PYPY:
204+
pytest.xfail(f"[TEST-GIL-SCOPED] {soabi} PyPy: " + msg)
205+
if env.MACOS:
206+
if not env.sys_is_gil_enabled():
207+
pytest.xfail(f"[TEST-GIL-SCOPED] {soabi} with GIL disabled: " + msg)
208+
if env.PY_GIL_DISABLED:
209+
pytest.xfail(f"[TEST-GIL-SCOPED] {soabi}: " + msg)
204210
raise RuntimeError(msg)
205211
return process.exitcode
206212
finally:

0 commit comments

Comments
 (0)