forked from pyodide/pyodide
-
Notifications
You must be signed in to change notification settings - Fork 3
349 lines (294 loc) · 8.98 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
name: main
on:
push:
pull_request:
concurrency:
group: main-${{ github.head_ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 3
jobs:
get_python_version:
runs-on: ubuntu-latest
outputs:
PYVERSION: ${{ steps.get_python_version.outputs.PYVERSION }}
steps:
- uses: actions/checkout@v4
- name: Read the Python version from Makefile.envs
id: get_python_version
run: |
echo "PYVERSION=$(git grep 'export PYVERSION ?=' Makefile.envs | cut -d' ' -f4)" >> "$GITHUB_OUTPUT"
test-python:
runs-on: ubuntu-latest
needs: get_python_version
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ needs.get_python_version.outputs.PYVERSION }}
- name: Install requirements
shell: bash -l {0}
run: |
mkdir test-results
python3 -m pip install -r requirements.txt -r requirements-deploy.txt
make pyodide_build
- name: Run tests
shell: bash -l {0}
run: |
PYODIDE_ROOT=. pytest \
--junitxml=test-results/junit.xml \
--verbose \
--runtime=host \
--cov=pyodide_build --cov=pyodide \
src packages/_tests tools/
- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
build-core:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
pyodide_packages: "tag:core,numpy${{ needs.test-scipy-trigger.outputs.test-scipy == 'true' && ',scipy' || '' }}"
- os: macos-14
pyodide_packages: "tag:core,numpy"
runs-on: ${{ matrix.os }}
needs: [test-scipy-trigger]
env:
EMSDK_NUM_CORES: 3
EMCC_CORES: 3
PYODIDE_JOBS: 3
CCACHE_DIR: /tmp/ccache
steps:
- uses: actions/checkout@v4
- name: Cache ccache output
uses: actions/cache@v4
with:
path: |
/tmp/ccache
key: ${{ hashFiles('Makefile.envs') }}-${{ runner.os }}-v20211025-
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: pyodide-env
environment-file: environment.yml
channels: conda-forge
- name: Check Versions
shell: bash -l {0}
run: |
python --version
node --version
npm --version
which python
which node
which npm
- name: Install dependencies (ubuntu)
shell: bash -l {0}
if: ${{ contains(runner.os, 'ubuntu') }}
run: |
sudo apt install -y build-essential git xxd
- name: Install dependencies (macos)
shell: bash -l {0}
if: ${{ contains(runner.os, 'macos') }}
run: |
brew install coreutils
- name: Install dependencies (Python)
shell: bash -l {0}
run: |
pip install -r requirements.txt
- name: Build emsdk
shell: bash -l {0}
run: |
which ccache
ccache -z
make -C emsdk
ccache -s
- name: Build Cpython
shell: bash -l {0}
run: |
# This is necessary to use the ccache from emsdk
source pyodide_env.sh
which ccache
ccache -z
make -C cpython
ccache -s
- name: build Pyodide with packages ${{ matrix.pyodide_packages }}
shell: bash -l {0}
run: |
# This is necessary to use the ccache from emsdk
source pyodide_env.sh
ccache -z
PYODIDE_PACKAGES=${{ matrix.pyodide_packages }} make
ccache -s
- name: check-size
shell: bash -l {0}
run: |
ls -lh dist/
pip install brotli
./tools/check_compressed_size.py dist/pyodide.asm.* dist/python_stdlib*
- name: Store artifacts build
uses: actions/upload-artifact@v4
with:
name: core-build-${{ runner.os }}
path: ./dist/
retention-days: 60
test-core:
runs-on: ${{ matrix.os }}
env:
DISPLAY: :99
needs: [build-core]
strategy:
fail-fast: false
matrix:
os: [macos-14]
runner: [selenium]
browser: [safari]
steps:
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: core-build-${{ runner.os }}
path: ./dist/
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: pyodide-env
python-version: "3.12"
channels: conda-forge
- name: install test requirements
shell: bash -l {0}
run: |
pip install -r requirements.txt -r requirements-deploy.txt
make pyodide_build
- uses: pyodide/pyodide-actions/install-browser@v2
with:
runner: ${{ matrix.runner }}
browser: ${{ matrix.browser }}
- name: run core tests
env:
BROWSER: ${{ matrix.browser }}
RUNNER: ${{ matrix.runner }}
shell: bash -l {0}
run: |
ls -lh
ls -lh dist/
tools/pytest_wrapper.py src packages/micropip/ tools/ \
-v \
-k "not webworker" \
--runtime="${BROWSER}-no-host" \
--runner "${RUNNER}" \
--durations 50 \
--junitxml=test-results/core_test.xml
- name: run package tests
env:
BROWSER: ${{ matrix.browser }}
RUNNER: ${{ matrix.runner }}
shell: bash -l {0}
run: |
ls -lh
ls -lh dist/
tools/pytest_wrapper.py packages/*/test* \
-v \
-k "numpy and not joblib" \
--runtime="${BROWSER}-no-host" \
--runner "${RUNNER}" \
--durations 50 \
--junitxml=test-results/packages_test.xml
- name: Test Summary
uses: test-summary/action@v2
with:
paths: "test-results/*.xml"
if: always()
test-scipy-trigger:
name: test-scipy-trigger
runs-on: ubuntu-latest
outputs:
test-scipy: ${{ steps.check-build-trigger.outputs.trigger }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check build trigger
id: check-build-trigger
shell: bash
run: |
set -e -x
COMMIT_MSG=$(git log --no-merges -1 --oneline)
# The scipy tests will be triggered on push or on pull_request when the commit
# message contains "[scipy]"
if [[ "$GITHUB_EVENT_NAME" == push ||
"$COMMIT_MSG" =~ \[scipy\] ]]; then
echo "trigger=true" >> "$GITHUB_OUTPUT"
fi
test-scipy:
runs-on: ${{ matrix.os }}
needs: [test-scipy-trigger, build-core]
if: needs.test-scipy-trigger.outputs.test-scipy
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: core-build-${{ runner.os }}
path: ./dist/
- name: run scipy tests inside node
shell: bash -l {0}
run: |
npm install pyodide
cp -f dist/* node_modules/pyodide
# This uses conftest.py on the current working directory to
# skip/xfail tests in scipy
cd packages/scipy
# XXX for some unknown reason adding a conftest.py in the repo throws off the
# other tests trying to import from conftest they find the scipy one ...
mv scipy-conftest.py conftest.py
node scipy-pytest.js --pyargs scipy -m 'not slow' -ra -v
test-bun:
runs-on: ${{ matrix.os }}
needs: [build-core]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: core-build-${{ runner.os }}
path: ./dist/
- uses: oven-sh/setup-bun@v2
- name: install test requirements
working-directory: src/test-bun
run: |
bun --version
bun install
- name: run bun tests
working-directory: src/test-bun
run: bun smoke-test.js
test-deno:
runs-on: ${{ matrix.os }}
needs: [build-core]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: core-build-${{ runner.os }}
path: ./dist/
- name: install test requirements
shell: bash -l {0}
run: |
curl -fsSL https://deno.land/install.sh | sudo DENO_INSTALL=/usr/local sh -s v1.33.1
deno --version
- name: run deno tests
shell: bash -l {0}
run: cd src/test-deno && deno task test