diff --git a/.github/workflows/buildwheels.yml b/.github/workflows/buildwheels.yml index b985768..cdd3b43 100644 --- a/.github/workflows/buildwheels.yml +++ b/.github/workflows/buildwheels.yml @@ -44,8 +44,25 @@ jobs: path: ./wheelhouse/*.whl if-no-files-found: error + build_pyodide: + name: Build Pyodide (WebAssembly) wheels + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Build wheels + uses: pypa/cibuildwheel@v4.3.5 + env: + CIBW_PLATFORM: pyodide + + - uses: actions/upload-artifact@v4 + with: + name: wheel-artifact-pyodide + path: ./wheelhouse/*.whl + if-no-files-found: error + upload_pypi: - needs: [build_wheels, build_sdist] + needs: [build_wheels, build_pyodide, build_sdist] runs-on: ubuntu-latest # Only upload to PyPI when triggered by a tag (not manual workflow_dispatch) if: startsWith(github.ref, 'refs/tags/') diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 238957e..551e484 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,3 +28,16 @@ jobs: - name: Test run: python -m pytest tests -v + + pyodide: + # WebAssembly: 32-bit, no SIMD, no threads. cibuildwheel builds the + # wheels and runs the tests in Node. + name: Pyodide (WebAssembly) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Build and test + uses: pypa/cibuildwheel@v4.3.5 + env: + CIBW_PLATFORM: pyodide diff --git a/pyproject.toml b/pyproject.toml index 073d0fb..ccf955c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,6 +56,12 @@ archs = ["x86_64", "universal2", "arm64"] # are provided separately in the CI matrix, so each builds natively). archs = ["native"] +[tool.cibuildwheel.pyodide] +# WebAssembly wheels, one per Pyodide ABI (cp313: Pyodide 0.28 and 0.29; +# cp314: Pyodide 314; cp315). In a Pyodide venv, the pytest script starts +# with a shebang to a shell script, which macOS cannot run: python -m pytest. +test-command = "python -m pytest {project}/tests -q" + [tool.cibuildwheel.windows] # Build for 64-bit Windows (32-bit is rarely needed nowadays) archs = ["AMD64"]