Skip to content

Commit 3fc4ea6

Browse files
committed
ci: use cibuildwheel for pyodide test
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
1 parent 4a6c18a commit 3fc4ea6

File tree

2 files changed

+15
-37
lines changed

2 files changed

+15
-37
lines changed

.github/workflows/emscripten.yaml

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,16 @@ jobs:
1515
name: Pyodide wheel
1616
runs-on: ubuntu-22.04
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
with:
2020
submodules: true
2121
fetch-depth: 0
2222

23-
- uses: actions/setup-python@v4
23+
- uses: pypa/cibuildwheel@v2.19
24+
env:
25+
PYODIDE_BUILD_EXPORTS: whole_archive
26+
CFLAGS: -fexceptions
27+
LDFLAGS: -fexceptions
2428
with:
25-
python-version: "3.11"
26-
27-
- name: Install pyodide-build
28-
run: pip install pyodide-build==0.23.4
29-
30-
- name: Compute emsdk version
31-
id: compute-emsdk-version
32-
run: |
33-
# Prepare xbuild environment (side-effect)
34-
pyodide config list
35-
# Save EMSDK version
36-
EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version)
37-
echo "emsdk-version=$EMSCRIPTEN_VERSION" >> $GITHUB_OUTPUT
38-
39-
- uses: mymindstorm/setup-emsdk@v12
40-
with:
41-
version: ${{ steps.compute-emsdk-version.outputs.emsdk-version }}
42-
actions-cache-folder: emsdk-cache
43-
44-
- name: Build
45-
run: PYODIDE_BUILD_EXPORTS=whole_archive CFLAGS=-fexceptions LDFLAGS=-fexceptions pyodide build
46-
working-directory: tests
47-
48-
- uses: actions/setup-node@v3
49-
with:
50-
node-version: 18
51-
52-
- name: Set up Pyodide virtual environment
53-
run: |
54-
pyodide venv .venv-pyodide
55-
.venv-pyodide/bin/pip install $(echo -n tests/dist/*.whl)
56-
57-
- name: Test
58-
run: .venv-pyodide/bin/pytest -o timeout=0 tests/test_*.py
29+
package-dir: tests
30+
only: cp312-pyodide_wasm32

tests/pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
# builder for the tests (yet). Specifically, wheels can't be built from SDists.
33

44
[build-system]
5-
requires = ["scikit-build-core[pyproject]"]
5+
requires = ["scikit-build-core"]
66
build-backend = "scikit_build_core.build"
77

88
[project]
99
name = "pybind11_tests"
1010
version = "0.0.1"
1111
dependencies = ["pytest", "pytest-timeout", "numpy", "scipy"]
12+
13+
[tool.scikit-build.cmake.define]
14+
PYBIND11_FINDPYTHON = true
15+
16+
[tool.cibuildwheel]
17+
test-command = "pytest -o timeout=0 -p no:cacheprovider {project}/tests/test_*.py"

0 commit comments

Comments
 (0)