Skip to content

BUILD: Add Pyodide CI and build recipes #5

BUILD: Add Pyodide CI and build recipes

BUILD: Add Pyodide CI and build recipes #5

Workflow file for this run

name: Pyodide Tests
on:
pull_request:
branches:
- main
workflow_dispatch:
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
pyodide_tests:
name: Test on Pyodide
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: 3.13.2
- name: Setup Emscripten
uses: mymindstorm/setup-emsdk@v14
with:
version: 4.0.9
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 22
- name: Install build dependencies for sdist
run: |
python -m pip install --upgrade pip build
- name: Build sdist and unpack for Pyodide
run: |
python -m build --sdist --outdir dist
mkdir -p pyodide-recipes/packages/numpy-quaddtype
tar -xvzf "$(ls dist/*.tar.gz)" -C pyodide-recipes/packages/numpy-quaddtype
rm -rf dist
- name: Install pyodide-build
run: python -m pip install pyodide-build
- name: Install the Pyodide build env
run: pyodide xbuildenv install 0.29.2
- name: Build compiled dependencies for Pyodide
run: |
pyodide build-recipes \
--recipe-dir pyodide-recipes/packages \
--install \
numpy numpy-quaddtype
- name: Clean the Pyodide dist
run: find dist/ -type f ! -name '*.whl' -delete
- name: Create the Pyodide venv
run: |
# Set up Pyodide venv
pyodide venv .venv-pyodide
source .venv-pyodide/bin/activate
# Install numpy
python -m pip install $(ls dist/numpy-*.whl)
# Install numpy-quaddtype with test dependencies
python -m pip install "$(ls dist/numpy_quaddtype-*.whl)"[test]
- name: Run tests
run: |
source .venv-pyodide/bin/activate
python -m pytest -s tests