Skip to content

Commit 30519d0

Browse files
committed
ci: Add CPython trunk build
1 parent 68e6fda commit 30519d0

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed

.github/workflows/upstream.yml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,144 @@ jobs:
110110
# setuptools
111111
- name: Setuptools helpers test
112112
run: pytest tests/extra_setuptools
113+
114+
trunk-cpython:
115+
116+
strategy:
117+
matrix:
118+
# branch, tag or SHA
119+
cpython-ref:
120+
- 'main'
121+
- 'a0ad63e70e3682cdf7e87e28091bb54fe12a2d4e'
122+
123+
name: '🐍 trunk (${{ matrix.cpython-ref }}) • ubuntu-latest • x64'
124+
runs-on: ubuntu-latest
125+
if: "contains(github.event.pull_request.labels.*.name, 'python dev')"
126+
127+
steps:
128+
#
129+
# Install trunk cpython
130+
#
131+
- name: Setup directory env for cpython build
132+
run: echo "CPYTHON_DIR=$(realpath -m ${GITHUB_WORKSPACE}/cpython-trunk-build)" >> $GITHUB_ENV
133+
- uses: actions/checkout@v3
134+
with:
135+
repository: 'python/cpython'
136+
ref: ${{ matrix.cpython-ref }}
137+
path: ${{ env.CPYTHON_DIR }}
138+
139+
- name: Install Dependencies
140+
working-directory: ${{ env.CPYTHON_DIR }}
141+
run: sudo ./.github/workflows/posix-deps-apt.sh
142+
143+
- name: Configure CPython
144+
working-directory: ${{ env.CPYTHON_DIR }}
145+
run: ./configure --with-pydebug
146+
147+
- name: Build CPython
148+
working-directory: ${{ env.CPYTHON_DIR }}
149+
run: make -j4
150+
151+
- name: Display build info
152+
working-directory: ${{ env.CPYTHON_DIR }}
153+
run: make pythoninfo
154+
155+
- name: Install CPython
156+
working-directory: ${{ env.CPYTHON_DIR }}
157+
run: sudo make install
158+
159+
- name: Clean-up after CPython build
160+
run: sudo rm -rf ${{ env.CPYTHON_DIR }}
161+
162+
- name: Test default CPython version
163+
run: python3 --version
164+
165+
#
166+
# Pybind
167+
#
168+
- uses: actions/checkout@v3
169+
170+
- name: Setup Boost (Linux)
171+
if: runner.os == 'Linux'
172+
run: sudo apt-get install libboost-dev
173+
174+
- name: Update CMake
175+
uses: jwlawson/[email protected]
176+
177+
- name: Prepare env
178+
run: |
179+
python -m pip install -r tests/requirements.txt
180+
181+
- name: Setup annotations on Linux
182+
if: runner.os == 'Linux'
183+
run: python -m pip install pytest-github-actions-annotate-failures
184+
185+
# First build - C++11 mode and inplace
186+
- name: Configure C++11
187+
run: >
188+
cmake -S . -B .
189+
-DPYBIND11_WERROR=ON
190+
-DDOWNLOAD_CATCH=ON
191+
-DDOWNLOAD_EIGEN=ON
192+
-DCMAKE_CXX_STANDARD=11
193+
194+
- name: Build C++11
195+
run: cmake --build . -j 2
196+
197+
- name: Python tests C++11
198+
run: cmake --build . --target pytest -j 2
199+
200+
- name: C++11 tests
201+
run: cmake --build . --target cpptest -j 2
202+
203+
- name: Interface test C++11
204+
run: cmake --build . --target test_cmake_build
205+
206+
- name: Clean directory
207+
run: git clean -fdx
208+
209+
# Second build - C++17 mode and in a build directory
210+
- name: Configure C++17
211+
run: >
212+
cmake -S . -B build2
213+
-DPYBIND11_WERROR=ON
214+
-DDOWNLOAD_CATCH=ON
215+
-DDOWNLOAD_EIGEN=ON
216+
-DCMAKE_CXX_STANDARD=17
217+
${{ matrix.args }}
218+
${{ matrix.args2 }}
219+
220+
- name: Build
221+
run: cmake --build build2 -j 2
222+
223+
- name: Python tests
224+
run: cmake --build build2 --target pytest
225+
226+
- name: C++ tests
227+
run: cmake --build build2 --target cpptest
228+
229+
# Third build - C++17 mode with unstable ABI
230+
- name: Configure (unstable ABI)
231+
run: >
232+
cmake -S . -B build3
233+
-DPYBIND11_WERROR=ON
234+
-DDOWNLOAD_CATCH=ON
235+
-DDOWNLOAD_EIGEN=ON
236+
-DCMAKE_CXX_STANDARD=17
237+
-DPYBIND11_INTERNALS_VERSION=10000000
238+
"-DPYBIND11_TEST_OVERRIDE=test_call_policies.cpp;test_gil_scoped.cpp;test_thread.cpp"
239+
${{ matrix.args }}
240+
241+
- name: Build (unstable ABI)
242+
run: cmake --build build3 -j 2
243+
244+
- name: Python tests (unstable ABI)
245+
run: cmake --build build3 --target pytest
246+
247+
- name: Interface test
248+
run: cmake --build build3 --target test_cmake_build
249+
250+
# This makes sure the setup_helpers module can build packages using
251+
# setuptools
252+
- name: Setuptools helpers test
253+
run: pytest tests/extra_setuptools

0 commit comments

Comments
 (0)