Skip to content

Commit 89aa103

Browse files
Add CI job to test out-of-tree Pyodide builds
1 parent bf89533 commit 89aa103

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

.github/workflows/emscripten.yml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Attributed to NumPy https://github.com/numpy/numpy/pull/25894
2+
# https://github.com/numpy/numpy/blob/d2d2c25fa81b47810f5cbd85ea6485eb3a3ffec3/.github/workflows/emscripten.yml
3+
#
4+
5+
name: Pyodide wheel
6+
7+
on:
8+
# TODO: refine after this is ready to merge
9+
[push, pull_request, workflow_dispatch]
10+
11+
env:
12+
FORCE_COLOR: 3
13+
PYODIDE_VERSION: 0.25.1
14+
# PYTHON_VERSION and EMSCRIPTEN_VERSION are determined by PYODIDE_VERSION.
15+
# The appropriate versions can be found in the Pyodide repodata.json
16+
# "info" field, or in Makefile.envs:
17+
# https://github.com/pyodide/pyodide/blob/main/Makefile.envs#L2
18+
PYTHON_VERSION: 3.11.3
19+
EMSCRIPTEN_VERSION: 3.1.46
20+
NODE_VERSION: 18
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
24+
cancel-in-progress: true
25+
26+
permissions:
27+
contents: read # to fetch code (actions/checkout)
28+
29+
jobs:
30+
build_wasm_emscripten:
31+
name: Build and test Zarr for Pyodide
32+
runs-on: ubuntu-22.04
33+
# To enable this workflow on a fork, comment out:
34+
# FIXME: uncomment after this is ready to merge
35+
# if: github.repository == 'zarr-developers/zarr-python'
36+
steps:
37+
- name: Checkout Zarr repository
38+
uses: actions/checkout@v4
39+
40+
- name: Set up Python ${{ env.PYTHON_VERSION }}
41+
id: setup-python
42+
uses: actions/setup-python@v5
43+
with:
44+
python-version: ${{ env.PYTHON_VERSION }}
45+
46+
- name: Set up Emscripten toolchain
47+
uses: mymindstorm/setup-emsdk@v14
48+
with:
49+
version: ${{ env.EMSCRIPTEN_VERSION }}
50+
actions-cache-folder: emsdk-cache
51+
52+
- name: Set up Node.js
53+
uses: actions/setup-node@v4
54+
with:
55+
node-version: ${{ env.NODE_VERSION }}
56+
57+
- name: Install pyodide-build
58+
run: python -m pip install "pyodide-build==${{ env.PYODIDE_VERSION }}"
59+
60+
- name: Build Zarr for Pyodide
61+
run: |
62+
pyodide build
63+
64+
- name: Run Zarr tests for Pyodide
65+
run: |
66+
pyodide venv .venv-pyodide
67+
source .venv-pyodide/bin/activate
68+
python -m pip install dist/*.whl
69+
python -m pip install pytest pytest-cov
70+
python -m pytest -v --cov=zarr --cov-config=pyproject.toml zarr
71+
72+
- name: Upload Pyodide wheel artifact for debugging
73+
# FIXME: Remove after this is ready to merge
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: zarr-pyodide-wheel
77+
path: dist/*.whl
78+
79+

0 commit comments

Comments
 (0)