-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
CI Move Pyodide CI from Azure to GitHub Actions #29791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
22aa88f
37884ac
d9d43fa
776e2c9
85d644d
527c151
5ba18f0
d04b38e
d6708a6
2760c38
16267d7
961a9d4
ee3228e
383bf7e
7efd95d
cfae5ff
3ae370f
f16a501
382c8ba
049ccca
b398144
3af4ea2
4a45a97
745f6f9
0675412
a9d7e6c
86247ad
5b4d043
8acf67e
ecd3104
17f1c64
6759395
9a617e1
8d96f2a
e02c0e2
a62074c
bf8ed31
24388f1
ffc0cb8
16b0761
033c488
b4b6ed7
345bbed
04d850c
99104e7
9f78d4d
d7b3254
c434599
93ef796
6e8a6cb
03eb460
e93a405
f122250
e4091ec
6058521
c243c16
f19cca9
bf0c3e5
1e41a61
b6b3e09
5c9b11c
2fd9b50
6802778
09ded37
74b7344
4831d6d
8f81fa7
1db9ebd
a7bb1e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
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 | ||
agriyakhetarpal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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 | ||
agriyakhetarpal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
persist-credentials: false | ||
|
||
- uses: pypa/cibuildwheel@d04cacbc9866d432033b1d09142936e6a0e2121a # v2.23.2 | ||
env: | ||
CIBW_PLATFORM: pyodide | ||
SKLEARN_SKIP_OPENMP_TEST: "true" | ||
SKLEARN_SKIP_NETWORK_TESTS: 1 | ||
CIBW_TEST_REQUIRES: "pytest pandas" | ||
CIBW_TEST_COMMAND: "python -m pytest -svra --pyargs sklearn --durations 20 --showlocals" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to upload the Pyodide wheel to anaconda.org when the tests pass, like numpy does. I guess this can be done in a separate PR. The middle-term goal would be to use the Pyodide wheel on anaconda.org inside our doc JupyterLite. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I left it for a follow-up PR, indeed. On being able to use the Pyodide wheel, there are two approaches I have in mind:
Which one of these would you prefer? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My preference would be the following for now because I feel this is the simplest option (we can always change our mind later):
One of my concern for your approach in scikit-image is the size of the wheel (~12M for scikit-learn Pyodide wheel). On each commit of the repo, we will push an updated wheel and the size of the scikit-learn.github.io repo grows quite quickly. To be honest, maybe the size of the Pyodide wheel is actually quite small compared to the size of the website (~300MB) ...
I'll try to have a closer look although I can't make any promises 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see – the increased size of the docs repository would make it quite big (I thought new builds are being overwritten on the gh-pages branch). Also, I see that the size of the zipped docs is monotonically increasing with each version for recent versions: https://scikit-learn.org/dev/versions.html, so while it it's okay for archives, it's indeed nicer if a GitHub repository does not include any more binary files than it needs to. I'm happy to implement the notebook modifications you suggest once this PR is merged! |
||
|
||
- name: Upload wheel artifact | ||
uses: actions/upload-artifact@v4 | ||
agriyakhetarpal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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: {} | ||
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 | ||
agriyakhetarpal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
path: wheelhouse/ | ||
merge-multiple: true | ||
|
||
- name: Push to Anaconda PyPI index | ||
uses: scientific-python/upload-nightly-action@82396a2ed4269ba06c6b2988bb4fd568ef3c3d6b # 0.6.1 | ||
with: | ||
artifacts_path: wheelhouse/ | ||
anaconda_nightly_upload_token: ${{ secrets.SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN }} |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1475,7 +1475,7 @@ def _mock_urlopen_raise(request, *args, **kwargs): | |
(False, "pandas"), | ||
], | ||
) | ||
def test_fetch_openml_verify_checksum(monkeypatch, as_frame, cache, tmpdir, parser): | ||
def test_fetch_openml_verify_checksum(monkeypatch, as_frame, tmpdir, parser): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, |
||
"""Check that the checksum is working as expected.""" | ||
if as_frame or parser == "pandas": | ||
pytest.importorskip("pandas") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,6 @@ | |
check_transformer_get_feature_names_out_pandas, | ||
parametrize_with_checks, | ||
) | ||
from sklearn.utils.fixes import _IS_WASM | ||
|
||
|
||
def test_all_estimator_no_base_class(): | ||
|
@@ -134,7 +133,6 @@ def test_check_estimator_generate_only_deprecation(): | |
assert isgenerator(all_instance_gen_checks) | ||
|
||
|
||
@pytest.mark.xfail(_IS_WASM, reason="importlib not supported for Pyodide packages") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is weird What I am guessing happens is that this test somehow works because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 I'm not sure why that's the case. I tried it just now – both in JupyterLite and in the Pyodide (stable) console and I was able to Either way, it's nice that the test now works – I hope! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think In any case this is not really important since the test appears to pass now 🤷. |
||
@pytest.mark.filterwarnings( | ||
"ignore:Since version 1.0, it is not needed to import " | ||
"enable_hist_gradient_boosting anymore" | ||
|
Uh oh!
There was an error while loading. Please reload this page.