Skip to content

Commit 55c4b1d

Browse files
committed
CI: extend the usage of cibuildwheel and install the built wheels
1 parent 2fc8219 commit 55c4b1d

File tree

1 file changed

+51
-6
lines changed

1 file changed

+51
-6
lines changed

.github/workflows/build_wheel.yml

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
os: [ubuntu-latest]
13+
os: [ubuntu-latest, windows-latest, macos-latest]
1414

1515
steps:
1616
- uses: actions/checkout@v4
1717

1818
- name: Build wheels
19-
uses: pypa/cibuildwheel@v2.22.0
19+
uses: pypa/cibuildwheel@v3.0.1
2020
env:
2121
CIBW_BUILD: >
2222
cp311-*
@@ -27,20 +27,65 @@ jobs:
2727
*-win32
2828
*_i686
2929
CIBW_BEFORE_BUILD: >
30-
cmake -B build -S .
30+
python -m pip install --upgrade pip
31+
&& pip install numpy
32+
&& cmake -B build -S .
33+
-DPython3_FIND_STRATEGY=LOCATION
3134
-DCMAKE_BUILD_TYPE=Release
3235
-DSPIRIT_BUILD_FOR_PYTHON=ON
33-
-DSPIRIT_BUILD_TEST=OFF
36+
-DSPIRIT_BUILD_TEST=ON
3437
-DSPIRIT_UI_CXX_USE_QT=OFF
3538
-DSPIRIT_UI_IMGUI=OFF
36-
&& cmake --build build -j2
39+
&& cmake --build build --config Release -j2
40+
&& ctest -C Release --test-dir build --output-on-failure
3741
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
42+
CIBW_ENVIRONMENT: >
43+
SPIRIT_ADD_VERSION_SUFFIX=${{ github.ref == 'refs/heads/master' }}
3844
with:
3945
package-dir: ./core/python
4046
output-dir: wheelhouse
4147
config-file: "{package}/pyproject.toml"
4248

4349
- uses: actions/upload-artifact@v4
4450
with:
45-
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
51+
name: cibw-wheels-${{ matrix.os }}
4652
path: ./wheelhouse/*.whl
53+
54+
install_wheels:
55+
name: Install wheels on ${{ matrix.os }} (python-${{ matrix.python }})
56+
runs-on: ${{ matrix.os }}
57+
needs: build_wheels
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
os: [ubuntu-latest, windows-latest, macos-latest]
62+
python: ["3.11", "3.12"]
63+
64+
steps:
65+
- name: Set up Python ${{ matrix.python }}
66+
uses: actions/setup-python@v4
67+
with:
68+
python-version: ${{ matrix.python }}
69+
70+
- name: Download built wheels
71+
uses: actions/download-artifact@v4
72+
with:
73+
name: cibw-wheels-${{ matrix.os }}
74+
path: wheelhouse
75+
76+
- name: Install wheel in a clean env
77+
shell: bash
78+
run: |
79+
python -m pip install --upgrade pip
80+
pip install wheelhouse/*.whl
81+
82+
- name: Smoke‑test import
83+
shell: bash
84+
run: |
85+
python - <<'EOF'
86+
import spirit
87+
print("Imported version:", spirit.__version__)
88+
from spirit import state
89+
with state.State(quiet=False) as p_state:
90+
pass
91+
EOF

0 commit comments

Comments
 (0)