Skip to content

Commit

Permalink
ci: use cibuildwheel for pyodide test
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Jun 26, 2024
1 parent 4e811a4 commit 56398e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 36 deletions.
41 changes: 6 additions & 35 deletions .github/workflows/emscripten.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,10 @@ jobs:
submodules: true
fetch-depth: 0

- uses: actions/setup-python@v4
- uses: pypa/[email protected]
env:
PYODIDE_BUILD_EXPORTS: whole_archive
CFLAGS: -fexceptions
LDFLAGS: -fexceptions
with:
python-version: "3.11"

- name: Install pyodide-build
run: pip install pyodide-build==0.23.4

- name: Compute emsdk version
id: compute-emsdk-version
run: |
# Prepare xbuild environment (side-effect)
pyodide config list
# Save EMSDK version
EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version)
echo "emsdk-version=$EMSCRIPTEN_VERSION" >> $GITHUB_OUTPUT
- uses: mymindstorm/setup-emsdk@v12
with:
version: ${{ steps.compute-emsdk-version.outputs.emsdk-version }}
actions-cache-folder: emsdk-cache

- name: Build
run: PYODIDE_BUILD_EXPORTS=whole_archive CFLAGS=-fexceptions LDFLAGS=-fexceptions pyodide build
working-directory: tests

- uses: actions/setup-node@v3
with:
node-version: 18

- name: Set up Pyodide virtual environment
run: |
pyodide venv .venv-pyodide
.venv-pyodide/bin/pip install $(echo -n tests/dist/*.whl)
- name: Test
run: .venv-pyodide/bin/pytest -o timeout=0 tests/test_*.py
package-dir: tests
5 changes: 4 additions & 1 deletion tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
# builder for the tests (yet). Specifically, wheels can't be built from SDists.

[build-system]
requires = ["scikit-build-core[pyproject]"]
requires = ["scikit-build-core"]
build-backend = "scikit_build_core.build"

[project]
name = "pybind11_tests"
version = "0.0.1"
dependencies = ["pytest", "pytest-timeout", "numpy", "scipy"]

[tool.cibuildwheel]
test-command = "pytest -o timeout=0 {project}/tests/test_*.py"

0 comments on commit 56398e6

Please sign in to comment.