Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 10 additions & 99 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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/[email protected]

- 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
3 changes: 2 additions & 1 deletion .github/workflows/tests-cibw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
env:
Expand Down
4 changes: 4 additions & 0 deletions tests/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
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():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cpp_conduit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


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}'"
):
Expand Down
10 changes: 8 additions & 2 deletions tests/test_gil_scoped.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading