Skip to content

REL: Prepare for the NumPy 2.0.0rc2 release [wheel build] #7391

REL: Prepare for the NumPy 2.0.0rc2 release [wheel build]

REL: Prepare for the NumPy 2.0.0rc2 release [wheel build] #7391

Workflow file for this run

name: Test Emscripten/Pyodide build
on:
pull_request:
branches:
- main
- maintenance/**
env:
FORCE_COLOR: 3
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build-wasm-emscripten:
name: Build NumPy distribution for Pyodide
runs-on: ubuntu-22.04
# To enable this workflow on a fork, comment out:
if: github.repository == 'numpy/numpy'
env:
PYODIDE_VERSION: 0.25.1
# 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.3
EMSCRIPTEN_VERSION: 3.1.46
NODE_VERSION: 18
steps:
- name: Checkout NumPy
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
# This input shall fetch tags without the need to fetch the
# entire VCS history, see https://github.com/actions/checkout#usage
fetch-tags: true
- name: Set up Python ${{ env.PYTHON_VERSION }}
id: setup-python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- 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==${{ env.PYODIDE_VERSION }}
- name: Find installation for pyodide-build
shell: python
run: |
import os
import pyodide_build
from pathlib import Path
pyodide_build_path = Path(pyodide_build.__file__).parent
env_file = os.getenv('GITHUB_ENV')
with open(env_file, "a") as myfile:
myfile.write(f"PYODIDE_BUILD_PATH={pyodide_build_path}\n")
- name: Build NumPy for Pyodide
run: |
pyodide build -Cbuild-dir=build -Csetup-args="--cross-file=$PWD/tools/ci/emscripten/emscripten.meson.cross" -Csetup-args="-Dblas=none" -Csetup-args="-Dlapack=none"
- name: Set up Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ env.NODE_VERSION }}
- name: Set up Pyodide virtual environment
run: |
pyodide venv .venv-pyodide
source .venv-pyodide/bin/activate
pip install dist/*.whl
pip install -r requirements/emscripten_test_requirements.txt
- name: Test NumPy for Pyodide
run: |
source .venv-pyodide/bin/activate
cd ..
pytest --pyargs numpy -m "not slow"