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 bd3900ee79.

See also:

https://github.com/pybind/pybind11/pull/5822#issuecomment-3247827317

* 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: https://github.com/pybind/pybind11/pull/5822#issuecomment-3247998220

* 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 <HenrySchreinerIII@gmail.com>
This commit is contained in:
Ralf W. Grosse-Kunstleve
2025-09-03 09:06:41 -07:00
committed by GitHub
parent 3878c23f8d
commit cd56888c89
5 changed files with 25 additions and 103 deletions

View File

@@ -1019,8 +1019,15 @@ jobs:
fail-fast: false
matrix:
include:
- { sys: mingw64, env: x86_64 }
- { sys: mingw32, env: i686 }
- sys: mingw32
env: i686
extra_install: ""
- sys: mingw64
env: x86_64
extra_install: |
mingw-w64-x86_64-python-numpy
mingw-w64-x86_64-python-scipy
mingw-w64-x86_64-eigen3
steps:
- uses: msys2/setup-msys2@v2
with:
@@ -1034,15 +1041,7 @@ jobs:
mingw-w64-${{matrix.env}}-python-pytest
mingw-w64-${{matrix.env}}-boost
mingw-w64-${{matrix.env}}-catch
- uses: msys2/setup-msys2@v2
if: matrix.sys == 'mingw64'
with:
msystem: ${{matrix.sys}}
install: >-
mingw-w64-${{matrix.env}}-python-numpy
mingw-w64-${{matrix.env}}-python-scipy
mingw-w64-${{matrix.env}}-eigen3
${{ matrix.extra_install }}
- uses: actions/checkout@v4
@@ -1189,91 +1188,3 @@ jobs:
- name: Clean directory
run: git clean -fdx
macos_brew_install_llvm:
if: github.event.pull_request.draft == false
name: "macos-13 • brew install llvm"
runs-on: macos-13
env:
# https://apple.stackexchange.com/questions/227026/how-to-install-recent-clang-with-homebrew
LDFLAGS: '-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib'
steps:
- name: Update PATH
run: echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
- name: Show env
run: env
- name: Checkout
uses: actions/checkout@v4
- name: Show Clang++ version before brew install llvm
run: clang++ --version
- name: brew install llvm
run: brew install llvm
- name: Show Clang++ version after brew install llvm
run: clang++ --version
- name: Update CMake
uses: jwlawson/actions-setup-cmake@v2.0
- name: Run pip installs
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r tests/requirements.txt
python3 -m pip install numpy
python3 -m pip install scipy
- name: Show CMake version
run: cmake --version
- name: CMake Configure
run: >
cmake -S . -B .
-DPYBIND11_WERROR=ON
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_STANDARD=17
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
- name: Build
run: cmake --build . -j 2
- name: Python tests
run: cmake --build . --target pytest -j 2
- name: C++ tests
run: cmake --build . --target cpptest -j 2
- name: Interface test
run: cmake --build . --target test_cmake_build -j 2
- name: Visibility test
run: cmake --build . --target test_cross_module_rtti -j 2
- name: CMake Configure - Exercise cmake -DPYBIND11_TEST_OVERRIDE
run: >
cmake -S . -B build_partial
-DPYBIND11_WERROR=ON
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_STANDARD=17
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
"-DPYBIND11_TEST_OVERRIDE=test_call_policies.cpp;test_gil_scoped.cpp;test_thread.cpp"
- name: Build - Exercise cmake -DPYBIND11_TEST_OVERRIDE
run: cmake --build build_partial -j 2
- name: Python tests - Exercise cmake -DPYBIND11_TEST_OVERRIDE
run: cmake --build build_partial --target pytest -j 2
- name: Clean directory
run: git clean -fdx

View File

@@ -42,7 +42,8 @@ jobs:
submodules: true
fetch-depth: 0
- run: brew upgrade cmake
# We have to uninstall first because GH is now using a local tap to build cmake<4, iOS needs cmake>=4
- run: brew uninstall cmake && brew install cmake
- uses: pypa/cibuildwheel@v3.1
env:

View File

@@ -18,7 +18,11 @@ _graalpy_version = (
sys.modules["__graalpython__"].get_graalvm_version() if GRAALPY else "0.0.0"
)
GRAALPY_VERSION = tuple(int(t) for t in _graalpy_version.split("-")[0].split(".")[:3])
# Compile-time config (what the binary was built for)
PY_GIL_DISABLED = bool(sysconfig.get_config_var("Py_GIL_DISABLED"))
# Runtime state (what's actually happening now)
sys_is_gil_enabled = getattr(sys, "_is_gil_enabled", lambda: True)
def deprecated_call():

View File

@@ -12,7 +12,7 @@ from pybind11_tests import cpp_conduit as home_planet
def import_warns_freethreaded(name):
if name not in sys.modules and not getattr(sys, "_is_gil_enabled", lambda: True)():
if name not in sys.modules and not env.sys_is_gil_enabled():
with pytest.warns(
RuntimeWarning, match=f"has been enabled to load module '{name}'"
):

View File

@@ -199,8 +199,14 @@ def _run_in_process(target, *args, **kwargs):
if process.exitcode is None:
assert t_delta > 0.9 * timeout
msg = "DEADLOCK, most likely, exactly what this test is meant to detect."
if env.PYPY and env.WIN:
pytest.skip(msg)
soabi = sysconfig.get_config_var("SOABI")
if env.WIN and env.PYPY:
pytest.xfail(f"[TEST-GIL-SCOPED] {soabi} PyPy: " + msg)
if env.MACOS:
if not env.sys_is_gil_enabled():
pytest.xfail(f"[TEST-GIL-SCOPED] {soabi} with GIL disabled: " + msg)
if env.PY_GIL_DISABLED:
pytest.xfail(f"[TEST-GIL-SCOPED] {soabi}: " + msg)
raise RuntimeError(msg)
return process.exitcode
finally: