8000 CI Move Pyodide CI from Azure to GitHub Actions (#29791) · lucyleeow/scikit-learn@76bead0 · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit 76bead0

Browse files
agriyakhetarpallesteveogrisel
authored andcommitted
CI Move Pyodide CI from Azure to GitHub Actions (scikit-learn#29791)
Co-authored-by: Loïc Estève <loic.esteve@ymail.com> Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
1 parent 5afcfb6 commit 76bead0

File tree

10 files changed

+105
-131
lines changed

10 files changed

+105
-131
lines changed

.github/workflows/emscripten.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Test Emscripten/Pyodide build
2+
3+
on:
4+
schedule:
5+
# Nightly build at 3:42 A.M.
6+
- cron: "42 3 */1 * *"
7+
push:
8+
branches:
9+
- main
10+
# Release branches
11+
- "[0-9]+.[0-9]+.X"
12+
pull_request:
13+
branches:
14+
- main
15+
- "[0-9]+.[0-9]+.X"
16+
# Manual run
17+
workflow_dispatch:
18+
19+
env:
20+
FORCE_COLOR: 3
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
24+
cancel-in-progress: true
25+
26+
permissions:
27+
contents: read
28+
29+
jobs:
30+
check_build_trigger:
31+
name: Check build trigger
32+
runs-on: ubuntu-latest
33+
if: github.repository == 'scikit-learn/scikit-learn'
34+
outputs:
35+
build: ${{ steps.check_build_trigger.outputs.build }}
36+
steps:
37+
- name: Checkout scikit-learn
38+
uses: actions/checkout@v4
39+
with:
40+
ref: ${{ github.event.pull_request.head.sha }}
41+
persist-credentials: false
42+
43+
- id: check_build_trigger
44+
name: Check build trigger
45+
shell: bash
46+
run: |
47+
set -e
48+
set -x
49+
50+
COMMIT_MSG=$(git log --no-merges -1 --oneline)
51+
52+
# The commit marker "[pyodide]" will trigger the build when required
53+
if [[ "$GITHUB_EVENT_NAME" == schedule ||
54+
"$GITHUB_EVENT_NAME" == workflow_dispatch ||
55+
"$COMMIT_MSG" =~ \[pyodide\] ]]; then
56+
echo "build=true" >> $GITHUB_OUTPUT
57+
fi
58+
59+
build_wasm_wheel:
60+
name: Build WASM wheel
61+
runs-on: ubuntu-latest
62+
needs: check_build_trigger
63+
if: needs.check_build_trigger.outputs.build
64+
steps:
65+
- name: Checkout scikit-learn
66+
uses: actions/checkout@v4
67+
with:
68+
persist-credentials: false
69+
70+
- uses: pypa/cibuildwheel@d04cacbc9866d432033b1d09142936e6a0e2121a # v2.23.2
71+
env:
72+
CIBW_PLATFORM: pyodide
73+
SKLEARN_SKIP_OPENMP_TEST: "true"
74+
SKLEARN_SKIP_NETWORK_TESTS: 1
75+
CIBW_TEST_REQUIRES: "pytest pandas"
76+
CIBW_TEST_COMMAND: "python -m pytest -svra --pyargs sklearn --durations 20 --showlocals"
77+
78+
- name: Upload wheel artifact
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: pyodide_wheel
82+
path: ./wheelhouse/*.whl
83+
if-no-files-found: error
84+
85+
# Push to https://anaconda.org/scientific-python-nightly-wheels/scikit-learn
86+
# WARNING: this job will overwrite any existing WASM wheels.
87+
upload-wheels:
88+
name: Upload scikit-learn WASM wheels to Anaconda.org
89+
runs-on: ubuntu-latest
90+
permissions: {}
91+
needs: [build_wasm_wheel]
92+
if: github.repository == 'scikit-learn/scikit-learn' && github.event_name != 'pull_request'
93+
steps:
94+
- name: Download wheel artifact
95+
uses: actions/download-artifact@v4
96+
with:
97+
path: wheelhouse/
98+
merge-multiple: true
99+
100+
- name: Push to Anaconda PyPI index
101+
uses: scientific-python/upload-nightly-action@82396a2ed4269ba06c6b2988bb4fd568ef3c3d6b # 0.6.1
102+
with:
103+
artifacts_path: wheelhouse/
104+
anaconda_nightly_upload_token: ${{ secrets.SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN }}

azure-pipelines.yml

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -89,39 +89,6 @@ jobs:
8989
LOCK_FILE: './build_tools/azure/pylatest_free_threaded_linux-64_conda.lock'
9090
COVERAGE: 'false'
9191

92-
- job: Linux_Nightly_Pyodide
93-
pool:
94-
vmImage: ubuntu-22.04
95-
variables:
96-
# Need to match Python version and Emscripten version for the correct
97-
# Pyodide version. For example, for Pyodide version 0.27.2, see
98-
# https://github.com/pyodide/pyodide/blob/0.27.2/Makefile.envs
99-
PYODIDE_VERSION: '0.27.2'
100-
EMSCRIPTEN_VERSION: '3.1.58'
101-
PYTHON_VERSION: '3.12.7'
102-
103-
dependsOn: [git_commit, linting]
104-
condition: |
105-
and(
106-
succeeded(),
107-
not(contains(dependencies['git_commit']['outputs']['commit.message'], '[ci skip]')),
108-
or(eq(variables['Build.Reason'], 'Schedule'),
109-
contains(dependencies['git_commit']['outputs']['commit.message'], '[pyodide]'
110-
)
111-
)
112-
)
113-
steps:
114-
- task: UsePythonVersion@0
115-
inputs:
116-
versionSpec: $(PYTHON_VERSION)
117-
addToPath: true
118-
119-
- bash: bash build_tools/azure/install_pyodide.sh
120-
displayName: Build Pyodide wheel
121-
122-
- bash: bash build_tools/azure/test_script_pyodide.sh
123-
displayName: Test Pyodide wheel
124-
12592
# Will run all the time regardless of linting outcome.
12693
- template: build_tools/azure/posix.yml
12794
parameters:

build_tools/azure/install_pyodide.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

build_tools/azure/pytest-pyodide.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

build_tools/azure/test_script_pyodide.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

sklearn/_loss/tests/test_loss.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
)
3030
from sklearn.utils import assert_all_finite
3131
from sklearn.utils._testing import create_memmap_backed_data, skip_if_32bit
32-
from sklearn.utils.fixes import _IS_WASM
3332

3433
ALL_LOSSES = list(_LOSSES.values())
3534

@@ -390,9 +389,6 @@ def test_loss_dtype(
390389
391390
Also check that input arrays can be readonly, e.g. memory mapped.
392391
"""
393-
if _IS_WASM and readonly_memmap: # pragma: nocover
394-
pytest.xfail(reason="memmap not fully supported")
395-
396392
loss = loss()
397393
# generate a y_true and raw_prediction in valid range
398394
n_samples = 5

sklearn/datasets/tests/test_openml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ def _mock_urlopen_raise(request, *args, **kwargs):
14751475
(False, "pandas"),
14761476
],
14771477
)
1478-
def test_fetch_openml_verify_checksum(monkeypatch, as_frame, cache, tmpdir, parser):
1478+
def test_fetch_openml_verify_checksum(monkeypatch, as_frame, tmpdir, parser):
14791479
"""Check that the checksum is working as expected."""
14801480
if as_frame or parser == "pandas":
14811481
pytest.importorskip("pandas")

sklearn/tests/test_common.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
check_transformer_get_feature_names_out_pandas,
6161
parametrize_with_checks,
6262
)
63-
from sklearn.utils.fixes import _IS_WASM
6463

6564

6665
def test_all_estimator_no_base_class():
@@ -134,7 +133,6 @@ def test_check_estimator_generate_only_deprecation():
134133
assert isgenerator(all_instance_gen_checks)
135134

136135

137-
@pytest.mark.xfail(_IS_WASM, reason="importlib not supported for Pyodide packages")
138136
@pytest.mark.filterwarnings(
139137
"ignore:Since version 1.0, it is not needed to import "
140138
"enable_hist_gradient_boosting anymore"

sklearn/tests/test_discriminant_analysis.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
assert_array_almost_equal,
2222
assert_array_equal,
2323
)
24-
from sklearn.utils.fixes import _IS_WASM
2524

2625
# Data is just 6 separable points in the plane
2726
X = np.array([[-2, -1], [-1, -1], [-1, -2], [1, 1], [1, 2], [2, 1]], dtype="f")
@@ -594,13 +593,6 @@ def test_qda_store_covariance():
594593
)
595594

596595

597-
@pytest.mark.xfail(
598-
_IS_WASM,
599-
reason=(
600-
"no floating point exceptions, see"
601-
" https://github.com/numpy/numpy/pull/21895#issuecomment-1311525881"
602-
),
603-
)
604596
def test_qda_regularization():
605597
# The default is reg_param=0. and will cause issues when there is a
606598
# constant variable.

sklearn/utils/tests/test_testing.py

Lines changed: 0 additions & 1 1241 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,6 @@ def test_tempmemmap(monkeypatch):
852852
assert registration_counter.nb_calls == 2
853853

854854

855-
@pytest.mark.xfail(_IS_WASM, reason="memmap not fully supported")
856855
def test_create_memmap_backed_data(monkeypatch):
857856
registration_counter = RegistrationCounter()
858857
monkeypatch.setattr(atexit, "register", registration_counter)

0 commit comments

Comments
 (0)
0