From 56398e6f7285fdca52399f27390725f22aa34eac Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 26 Jun 2024 15:26:57 -0400 Subject: [PATCH] ci: use cibuildwheel for pyodide test Signed-off-by: Henry Schreiner --- .github/workflows/emscripten.yaml | 41 +++++-------------------------- tests/pyproject.toml | 5 +++- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/.github/workflows/emscripten.yaml b/.github/workflows/emscripten.yaml index 9a84d3e12ae..2a363b120b0 100644 --- a/.github/workflows/emscripten.yaml +++ b/.github/workflows/emscripten.yaml @@ -20,39 +20,10 @@ jobs: submodules: true fetch-depth: 0 - - uses: actions/setup-python@v4 + - uses: pypa/cibuildwheel@v2.19 + 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 diff --git a/tests/pyproject.toml b/tests/pyproject.toml index 97478b0b826..199ebcc5cd0 100644 --- a/tests/pyproject.toml +++ b/tests/pyproject.toml @@ -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"