Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 53 additions & 14 deletions .github/workflows/pyodide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,80 @@ name: Build pyodide wheel
on:
push:
branches: [dev]
pull_request:
branches: [dev]
workflow_dispatch:

env:
PYTHON_VERSION: 3.12.2
PYODIDE_VERSION: 0.26.3
EMSCRIPTEN_VERSION: 3.1.58

jobs:
build-pyodide:
runs-on: macos-latest
# macOS because setup.py's Linux flags break the Emscripten build. Intel
# because GitHub is short on macOS arm64 runners, and jobs waiting for one
# were cancelled.
runs-on: macos-15-intel
strategy:
fail-fast: false
matrix:
# Each Pyodide ABI needs its own wheel. The host Python has to match the
# Python that Pyodide ships, and Emscripten has to match its build.
# `pyodide xbuildenv search --all` lists all three for each release.
include:
# Wheel used by shinylive releases before the move off Pyodide 0.27.
# Newer pyodide-build names it `pyemscripten_2024_0` instead of
# `pyodide_2024_0`, so keep the old one. It needs `wheel<0.46`.
- pyodide: 0.26.3
python: "3.12"
emscripten: 3.1.58
pyodide-build: 'pyodide-build==0.26.3 "wheel<0.46"'
- pyodide: 0.29.5
python: "3.13"
emscripten: 4.0.9
pyodide-build: "pyodide-build==0.39.3"
- pyodide: 314.0.7
python: "3.14"
emscripten: 5.0.3
pyodide-build: "pyodide-build==0.39.3"
steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: ${{ matrix.python }}

- run: |
# Match pyodide version
# https://github.com/posit-dev/shinylive/blob/main/Makefile#L20C19-L20C25
pip install pyodide-build==0.26.3
if [ -z "${{ env.EMSCRIPTEN_VERSION }}"]; then
echo EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) >> $GITHUB_ENV
fi
pip install ${{ matrix.pyodide-build }}
pyodide xbuildenv install ${{ matrix.pyodide }}

- uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ env.EMSCRIPTEN_VERSION }}
version: ${{ matrix.emscripten }}

- run: pyodide build

- uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.pyodide }}
path: dist/*.whl

deploy:
# Pull requests only build, so the wheels can be checked before they are
# published.
if: github.event_name != 'pull_request'
needs: build-pyodide
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheel-*
path: dist
merge-multiple: true

- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
# Add to the wheels already published instead of replacing them.
# Released versions of shinylive download older wheels from here.
keep_files: true
Loading