Skip to content

Commit

Permalink
BLD: Use cibuildwheel to test Pyodide build
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal committed May 30, 2024
1 parent fa079a5 commit 5ecb7fc
Showing 1 changed file with 11 additions and 34 deletions.
45 changes: 11 additions & 34 deletions .github/workflows/emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,58 +29,35 @@ env:
jobs:
build_wasm_emscripten:
name: Build PyWavelets for Pyodide
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
# Comment out the following line to test changes on a fork
if: github.repository == 'PyWavelets/pywt'
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python 3.11
- name: Set up Python 3.12
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.11.2"
python-version: "3.12"

- name: Install prerequisites
run: |
python -m pip install pyodide-build
echo EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) >> $GITHUB_ENV
- name: Set up Emscripten toolchain
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ env.EMSCRIPTEN_VERSION }}
actions-cache-folder: emsdk-cache

- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: "18"

- name: Build PyWavelets
run: |
pyodide build
- name: Install and test wheel
run: |
pyodide venv .venv-pyodide
source .venv-pyodide/bin/activate
pip install dist/*.whl
pushd demo
pip install matplotlib pytest
python -c "import pywt; print(pywt.__version__)"
pytest -p no:cacheprovider --pyargs pywt -m "not slow"
- name: Build and test PyWavelets
uses: pypa/cibuildwheel@main
env:
CIBW_PLATFORM: pyodide
CIBW_TEST_REQUIRES: pytest matplotlib
CIBW_TEST_COMMAND: python -m pytest -p no:cacheprovider {package} -m 'not slow'

# https://anaconda.org/scientific-python-nightly-wheels/pywavelets
# WARNING: this job will overwrite existing wheels.
- name: Push to Anaconda PyPI index
- name: Push wheels to Anaconda PyPI index
if: >-
(github.repository == 'PyWavelets/pywt') &&
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.push_wheels == 'true') ||
(github.event_name == 'schedule')
uses: scientific-python/upload-nightly-action@b67d7fcc0396e1128a474d1ab2b48aa94680f9fc # v0.5.0
with:
artifacts_path: dist/
artifacts_path: wheelhouse/
anaconda_nightly_upload_token: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }}

0 comments on commit 5ecb7fc

Please sign in to comment.