Skip to content

Test Emscripten/Pyodide build #14

Test Emscripten/Pyodide build

Test Emscripten/Pyodide build #14

Workflow file for this run

name: Test Emscripten/Pyodide build
on:
schedule:
# Nightly build at 3:42 A.M.
- cron: "42 3 */1 * *"
push:
branches:
- main
# Release branches
- "[0-9]+.[0-9]+.X"
pull_request:
branches:
- main
- "[0-9]+.[0-9]+.X"
# Manual run
workflow_dispatch:
env:
FORCE_COLOR: 3
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
check_build_trigger:
name: Check build trigger
runs-on: ubuntu-latest
if: github.repository == 'scikit-learn/scikit-learn'
outputs:
build: ${{ steps.check_build_trigger.outputs.build }}
steps:
- name: Checkout scikit-learn
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- id: check_build_trigger
name: Check build trigger
shell: bash
run: |
set -e
set -x
COMMIT_MSG=$(git log --no-merges -1 --oneline)
# The commit marker "[pyodide]" will trigger the build when required
if [[ "$GITHUB_EVENT_NAME" == schedule ||
"$GITHUB_EVENT_NAME" == workflow_dispatch ||
"$COMMIT_MSG" =~ \[pyodide\] ]]; then
echo "build=true" >> $GITHUB_OUTPUT
fi
build_wasm_wheel:
name: Build WASM wheel
runs-on: ubuntu-latest
needs: check_build_trigger
if: needs.check_build_trigger.outputs.build
steps:
- name: Checkout scikit-learn
uses: actions/checkout@v4
with:
persist-credentials: false
- uses: pypa/cibuildwheel@faf86a6ed7efa889faf6996aa23820831055001a
env:
CIBW_PLATFORM: pyodide
SKLEARN_SKIP_OPENMP_TEST: "true"
SKLEARN_SKIP_NETWORK_TESTS: 1
# Temporary work-around to avoid joblib 1.5.0 until there is a joblib
# release with https://github.com/joblib/joblib/pull/1721
CIBW_TEST_REQUIRES: "pytest pandas joblib!=1.5.0"
# -s pytest argument is needed to avoid an issue in pytest output capturing with Pyodide
CIBW_TEST_COMMAND: "python -m pytest -svra --pyargs sklearn --durations 20 --showlocals"
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: pyodide_wheel
path: ./wheelhouse/*.whl
if-no-files-found: error
# Push to https://anaconda.org/scientific-python-nightly-wheels/scikit-learn
# WARNING: this job will overwrite any existing WASM wheels.
upload-wheels:
name: Upload scikit-learn WASM wheels to Anaconda.org
runs-on: ubuntu-latest
permissions: {}
environment: upload_anaconda
needs: [build_wasm_wheel]
if: github.repository == 'scikit-learn/scikit-learn' && github.event_name != 'pull_request'
steps:
- name: Download wheel artifact
uses: actions/download-artifact@v4
with:
path: wheelhouse/
merge-multiple: true
- name: Push to Anaconda PyPI index
uses: scientific-python/upload-nightly-action@b36e8c0c10dbcfd2e05bf95f17ef8c14fd708dbf # 0.6.2
with:
artifacts_path: wheelhouse/
anaconda_nightly_upload_token: ${{ secrets.SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN }}