@@ -31,98 +31,156 @@ env:
3131jobs :
3232 # This is the "main" test suite, which tests a large number of different
3333 # versions of default compilers and Python versions in GitHub Actions.
34- standard :
35- if : github.event.pull_request.draft == false
34+ # It is in two parts: one that always runs, and one that runs on non-draft
35+ standard-small :
3636 strategy :
3737 fail-fast : false
3838 matrix :
39- runs-on : [ubuntu-24.04, windows-2022, macos-14]
40- python :
41- - ' 3.8'
42- - ' 3.13'
43- - ' 3.13t'
44- - ' 3.14'
45- - ' 3.14t'
46- - ' pypy-3.10'
47- - ' pypy-3.11'
48- - ' graalpy-24.2'
49-
50- # Items in here will either be added to the build matrix (if not
51- # present), or add new keys to an existing matrix element if all the
52- # existing keys match.
53- #
54- # We support an optional key: args, for cmake args
5539 include :
56- # Just add a key
5740 - runs-on : ubuntu-22.04
58- python : ' 3.8'
59- args : >
60- -DPYBIND11_FINDPYTHON=OFF
61- -DCMAKE_CXX_FLAGS="-D_=1"
62- -DPYBIND11_NUMPY_1_ONLY=ON
63- exercise_D_ : 1
41+ python-version : ' 3.8'
42+ cmake-args : -DPYBIND11_FINDPYTHON=OFF -DPYBIND11_NUMPY_1_ONLY=ON
43+ - runs-on : ubuntu-latest
44+ python-version : ' 3.13'
45+ cmake-args : -DCMAKE_CXX_STANDARD=23 -DPYBIND11_SIMPLE_GIL_MANAGEMENT=ON
46+ - runs-on : ubuntu-latest
47+ python-version : ' 3.14t'
48+ cmake-args : -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS="-DPYBIND11_RUN_TESTING_WITH_SMART_HOLDER_AS_DEFAULT_BUT_NEVER_USE_IN_PRODUCTION_PLEASE"
49+ - runs-on : ubuntu-latest
50+ python-version : ' pypy3.11'
51+ cmake-args : -DCMAKE_CXX_STANDARD=17
52+ - runs-on : ubuntu-latest
53+ python-version : ' graalpy-24.2'
54+ cmake-args : -DCMAKE_CXX_STANDARD=20
55+
56+ - runs-on : macos-latest
57+ python-version : ' 3.14'
58+ cmake-args : -DCMAKE_CXX_STANDARD=14
59+
6460 - runs-on : windows-2022
65- python : ' 3.8'
66- args : >
67- -DPYBIND11_FINDPYTHON=OFF
68- # Inject a Windows 2019 run
61+ python-version : ' 3.8'
62+ cmake-args : -DPYBIND11_FINDPYTHON=OFF
63+
64+
65+ uses : ./.github/workflows/reusable-standard.yml
66+ with :
67+ runs-on : ${{ matrix.runs-on }}
68+ python-version : ${{ matrix.python-version }}
69+ cmake-args : ${{ matrix.cmake-args }}
70+
71+ standard-large :
72+ if : github.event.pull_request.draft == false
73+ strategy :
74+ fail-fast : false
75+ matrix :
76+ include :
77+ - runs-on : ubuntu-latest
78+ python-version : ' 3.8'
79+ cmake-args : -DPYBIND11_FINDPYTHON=ON -DCMAKE_CXX_STANDARD=17
80+ - runs-on : ubuntu-latest
81+ python-version : ' 3.10'
82+ cmake-args : -DCMAKE_CXX_STANDARD=20
83+ - runs-on : ubuntu-latest
84+ python-version : ' 3.11'
85+ args : -DCMAKE_CXX_FLAGS="-DPYBIND11_RUN_TESTING_WITH_SMART_HOLDER_AS_DEFAULT_BUT_NEVER_USE_IN_PRODUCTION_PLEASE" -DCMAKE_CXX_STANDARD=17
86+ - runs-on : ubuntu-latest
87+ python-version : ' 3.12'
88+ args : -DCMAKE_CXX_FLAGS="-DPYBIND11_RUN_TESTING_WITH_SMART_HOLDER_AS_DEFAULT_BUT_NEVER_USE_IN_PRODUCTION_PLEASE" -DPYBIND11_SIMPLE_GIL_MANAGEMENT=ON
89+ - runs-on : ubuntu-latest
90+ python-version : ' 3.13t'
91+ cmake-args : -DCMAKE_CXX_STANDARD=20 -DPYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION=ON
92+ - runs-on : ubuntu-latest
93+ python-version : ' 3.14'
94+ cmake-args : -DCMAKE_CXX_STANDARD=14
95+ - runs-on : ubuntu-latest
96+ python-version : ' pypy-3.10'
97+ cmake-args : -DCMAKE_CXX_STANDARD=14
98+ - runs-on : ubuntu-latest
99+ python-version : ' graalpy-24.1'
100+
101+ # No SciPy for macOS ARM
102+ - runs-on : macos-13
103+ python-version : ' 3.8'
104+ cmake-args : -DCMAKE_CXX_STANDARD=14
105+ - runs-on : macos-13
106+ python-version : ' 3.11'
107+ cmake-args : -DCMAKE_CXX_FLAGS="-DPYBIND11_RUN_TESTING_WITH_SMART_HOLDER_AS_DEFAULT_BUT_NEVER_USE_IN_PRODUCTION_PLEASE"
108+ - runs-on : macos-latest
109+ python-version : ' 3.12'
110+ cmake-args : -DCMAKE_CXX_STANDARD=17
111+ - runs-on : macos-13
112+ python-version : ' 3.13t'
113+ cmake-args : -DCMAKE_CXX_STANDARD=11
114+ - runs-on : macos-latest
115+ python-version : ' 3.14t'
116+ cmake-args : -DCMAKE_CXX_STANDARD=20
117+ - runs-on : macos-13
118+ python-version : ' pypy-3.10'
119+ cmake-args : -DCMAKE_CXX_STANDARD=17
120+ - runs-on : macos-latest
121+ python-version : ' pypy-3.11'
122+ - runs-on : macos-latest
123+ python-version : ' graalpy-24.2'
124+
69125 - runs-on : windows-2019
70126 python : ' 3.9'
71- # Inject a few runs with different runtime libraries
127+ cmake-args : -DCMAKE_CXX_FLAGS="-DPYBIND11_RUN_TESTING_WITH_SMART_HOLDER_AS_DEFAULT_BUT_NEVER_USE_IN_PRODUCTION_PLEASE"
72128 - runs-on : windows-2022
73- python : ' 3.8'
74- args : >
75- -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
76- -DPYBIND11_NUMPY_1_ONLY=ON
129+ python-version : ' 3.8'
130+ cmake-args : -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DPYBIND11_NUMPY_1_ONLY=ON
77131 - runs-on : windows-2022
78- python : ' 3.9'
79- args : >
80- -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL
132+ python-version : ' 3.9'
133+ cmake-args : -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL
81134 # This needs a python built with MTd
82135 # - runs-on: windows-2022
83- # python: '3.11'
84- # args: >
85- # -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug
136+ # python-version: '3.11'
137+ # cmake-args: -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug
86138 - runs-on : windows-2022
87- python : ' 3.13'
88- args : >
89- -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL
90- # Run tests with py::smart_holder as the default holder
91- # with recent (or ideally latest) released Python version.
92- - runs-on : ubuntu-latest
93- python : ' 3.12'
94- args : >
95- -DCMAKE_CXX_FLAGS="-DPYBIND11_RUN_TESTING_WITH_SMART_HOLDER_AS_DEFAULT_BUT_NEVER_USE_IN_PRODUCTION_PLEASE"
96- - runs-on : macos-13
97- python : ' 3.11'
98- args : >
99- -DCMAKE_CXX_FLAGS="-DPYBIND11_RUN_TESTING_WITH_SMART_HOLDER_AS_DEFAULT_BUT_NEVER_USE_IN_PRODUCTION_PLEASE"
100- - runs-on : macos-13
101- python : ' pypy-3.10'
139+ python-version : ' 3.10'
140+ cmake-args : -DCMAKE_CXX_FLAGS="/DPYBIND11_RUN_TESTING_WITH_SMART_HOLDER_AS_DEFAULT_BUT_NEVER_USE_IN_PRODUCTION_PLEASE /GR /EHsc"
102141 - runs-on : windows-2022
103- python : ' 3.10'
104- args : >
105- -DCMAKE_CXX_FLAGS="/DPYBIND11_RUN_TESTING_WITH_SMART_HOLDER_AS_DEFAULT_BUT_NEVER_USE_IN_PRODUCTION_PLEASE /GR /EHsc"
106- - runs-on : ' ubuntu-latest'
107- python : ' graalpy-24.1'
108-
109- exclude :
142+ python-version : ' 3.13'
143+ cmake-args : -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL
144+ - runs-on : windows-latest
145+ python-version : ' 3.13t'
146+ cmake-args : -DCMAKE_CXX_STANDARD=17
147+ - runs-on : windows-latest
148+ python-version : ' 3.14'
149+ cmake-args : -DCMAKE_CXX_STANDARD=20
150+ - runs-on : windows-latest
151+ python-version : ' 3.14t'
152+ cmake-args : -DCMAKE_CXX_STANDARD=14
153+ - runs-on : windows-latest
154+ python-version : ' pypy-3.10'
155+ cmake-args : -DCMAKE_CXX_STANDARD=17
156+ - runs-on : windows-latest
157+ python-version : ' pypy3.11'
158+ cmake-args : -DCMAKE_CXX_STANDARD=20
110159 # The setup-python action currently doesn't have graalpy for windows
111160 # See https://github.com/actions/setup-python/pull/880
112- - python : ' graalpy-24.2'
113- runs-on : ' windows-2022'
114- # No SciPy for Python 3.8 ARM
115- - runs-on : macos-14
116- python : ' 3.8'
117- # No NumPy for PyPy 3.10 ARM
118- - runs-on : macos-14
119- python : ' pypy-3.10'
120- # Beta 1 broken for compiling on GHA (thinks it's free-threaded)
121- - runs-on : windows-2022
122- python : ' 3.14'
123161
124162
125- name : " 🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 ${{ matrix.args }}"
163+ uses : ./.github/workflows/reusable-standard.yml
164+ with :
165+ runs-on : ${{ matrix.runs-on }}
166+ python-version : ${{ matrix.python-version }}
167+ cmake-args : ${{ matrix.cmake-args }}
168+
169+ # This checks inplace builds with C++11
170+ inplace :
171+ if : github.event.pull_request.draft == false
172+ strategy :
173+ fail-fast : false
174+ matrix :
175+ include :
176+ - runs-on : ubuntu-latest
177+ python : ' 3.9'
178+ - runs-on : macos-latest
179+ python : ' 3.12'
180+ - runs-on : windows-latest
181+ python : ' 3.11'
182+
183+ name : " 🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 inplace C++11"
126184 runs-on : ${{ matrix.runs-on }}
127185
128186 steps :
@@ -134,15 +192,6 @@ jobs:
134192 python-version : ${{ matrix.python }}
135193 allow-prereleases : true
136194
137- - name : Setup Boost (Linux)
138- # Can't use boost + define _
139- if : runner.os == 'Linux' && matrix.exercise_D_ != 1
140- run : sudo apt-get install libboost-dev
141-
142- - name : Setup Boost (macOS)
143- if : runner.os == 'macOS'
144- run : brew install boost
145-
146195 - name : Install uv
147196 uses : astral-sh/setup-uv@v6
148197 with :
@@ -151,17 +200,14 @@ jobs:
151200 - name : Prepare env
152201 run : uv pip install --python=python --system -r tests/requirements.txt
153202
154- - name : Setup annotations on Linux
155- if : runner.os == 'Linux'
156- run : uv pip install --python=python --system pytest-github-actions-annotate-failures
157-
158203 # TODO Resolve Windows Ninja shared object issue on Python 3.8+
159204 - name : Use Ninja except on Windows
160205 if : runner.os != 'Windows'
161206 run : echo "CMAKE_GENERATOR=Ninja" >> "$GITHUB_ENV"
162207
163208 # First build - C++11 mode and inplace
164- # More-or-less randomly adding -DPYBIND11_SIMPLE_GIL_MANAGEMENT=ON here
209+ # More-or-less randomly adding a few extra flags here
210+ # Checks to makes sure defining `_` is allowed
165211 - name : Configure C++11 ${{ matrix.args }}
166212 run : >
167213 cmake -S. -B.
@@ -172,7 +218,7 @@ jobs:
172218 -DDOWNLOAD_CATCH=ON
173219 -DDOWNLOAD_EIGEN=ON
174220 -DCMAKE_CXX_STANDARD=11
175- ${{ matrix.args }}
221+ -DCMAKE_CXX_FLAGS="-D_=1"
176222
177223 - name : Build C++11
178224 run : cmake --build .
@@ -186,42 +232,6 @@ jobs:
186232 - name : Interface test C++11
187233 run : cmake --build . --target test_cmake_build
188234
189- - name : Clean directory
190- run : git clean -fdx
191-
192- # Second build - C++17 mode and in a build directory
193- # More-or-less randomly adding -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF here.
194- - name : Configure C++17
195- run : >
196- cmake -S. -Bbuild2 -Werror=dev
197- -DPYBIND11_WERROR=ON
198- -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
199- -DPYBIND11_PYTEST_ARGS=-v
200- -DDOWNLOAD_CATCH=ON
201- -DDOWNLOAD_EIGEN=ON
202- -DCMAKE_CXX_STANDARD=17
203- ${{ matrix.args }}
204-
205- - name : Build
206- run : cmake --build build2
207-
208- - name : Python tests
209- run : cmake --build build2 --target pytest
210-
211- - name : C++ tests
212- run : cmake --build build2 --target cpptest
213-
214- - name : Interface test
215- run : cmake --build build2 --target test_cmake_build
216-
217- # This makes sure the setup_helpers module can build packages using
218- # setuptools
219- - name : Setuptools helpers test
220- run : |
221- uv pip install --python=python --system setuptools
222- pytest tests/extra_setuptools
223- if : matrix.runs-on != 'windows-2022'
224-
225235
226236 manylinux :
227237 name : Manylinux on 🐍 3.13t • GIL
0 commit comments