Skip to content

Commit

Permalink
Enable run for Emscripten/Pyodide wheels
Browse files Browse the repository at this point in the history
Copied with updates and suggestions received from numpy#24603 on 23/02/2024.
  • Loading branch information
agriyakhetarpal committed Feb 23, 2024
1 parent 0c51ac6 commit 3b6f382
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions .github/workflows/emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
branches:
- main
- maintenance/**
# TODO: remove both of these after everything is ready
push:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -19,50 +22,46 @@ permissions:
jobs:
build-wasm-emscripten:
runs-on: ubuntu-22.04
if: false # NOTE: job disabled, it needs to be moved to Meson (see gh-24603)
# if: "github.repository == 'numpy/numpy'"
env:
PYODIDE_VERSION: 0.23.1
PYODIDE_VERSION: 0.25.0
# PYTHON_VERSION and EMSCRIPTEN_VERSION are determined by PYODIDE_VERSION.
# The appropriate versions can be found in the Pyodide repodata.json
# "info" field, or in Makefile.envs:
# https://github.com/pyodide/pyodide/blob/main/Makefile.envs#L2
PYTHON_VERSION: 3.11.2
EMSCRIPTEN_VERSION: 3.1.32
PYTHON_VERSION: 3.111.3
EMSCRIPTEN_VERSION: 3.1.46
NODE_VERSION: 18
steps:
- name: Checkout numpy
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: true
# versioneer.py requires the latest tag to be reachable. Here we
# fetch the complete history to get access to the tags.
# A shallow clone can work when the following issue is resolved:
# https://github.com/actions/checkout/issues/338
fetch-depth: 0
# The fetch-tags input shall fetch tags for versioneer.py without
# the need to fetch the entire history, see
# https://github.com/actions/checkout#usage
fetch-tags: true

- name: set up python
- name: Set up Python ${{ env.PYTHON_VERSION }}
id: setup-python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}

- uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14
- name: Set up Emscripten toolchain
uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14
with:
version: ${{ env.EMSCRIPTEN_VERSION }}
actions-cache-folder: emsdk-cache

- name: Install pyodide-build
run: pip install "pydantic<2" pyodide-build==$PYODIDE_VERSION

- name: Build
- name: Build NumPy for Pyodide
run: |
# Pyodide is still in the process of adding better/easier support for
# non-setup.py based builds.
cp pyproject.toml.setuppy pyproject.toml
CFLAGS=-g2 LDFLAGS=-g2 pyodide build
pyodide build -Csetup-args="--cross-file=$PWD/tools/ci/emscripten.meson.cross"
- name: set up node
- name: Set up Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ env.NODE_VERSION }}
Expand All @@ -73,11 +72,10 @@ jobs:
source .venv-pyodide/bin/activate
pip install dist/*.whl
python -c "import sys; print(sys.platform)"
# TODO: when re-enabled this workflow, install test deps differently
# since ninja isn't installable with pyodide
pip install -r requirements/test_requirements.txt
- name: Test
- name: Test NumPy for Pyodide
run: |
source .venv-pyodide/bin/activate
cd ..
python numpy/runtests.py -n -vv
pytest --pyargs numpy -m "not slow"

0 comments on commit 3b6f382

Please sign in to comment.