forked from pyodide/pyodide
-
Notifications
You must be signed in to change notification settings - Fork 3
246 lines (210 loc) · 6.34 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
name: main
on:
push:
pull_request:
concurrency:
group: main-${{ github.head_ref }}
cancel-in-progress: true
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
- name: Setup Python ${{ needs.get_python_version.outputs.PYVERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ needs.get_python_version.outputs.PYVERSION }}
- name: Install requirements
shell: bash -l {0}
run: |
mkdir test-results
cd pyodide-build && python3 -m pip install -e ".[test,deploy]" && cd ..
python3 -m pip install pytest-cov hypothesis pytz
- 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 pyodide-build packages/micropip/ packages/_tests tools/
- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
build-core:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
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@v3
with:
path: |
/tmp/ccache
key: ${{ hashFiles('Makefile.envs') }}-${{ runner.os }}-v20211025-
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: pyodide-env
environment-file: environment.yml
channels: conda-forge
- name: Check Python versions
shell: bash -l {0}
run: |
python --version
which python
- 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 core + numpy
shell: bash -l {0}
run: |
# This is necessary to use the ccache from emsdk
source pyodide_env.sh
ccache -z
PYODIDE_PACKAGES="tag:core,numpy" 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@v3
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: [ubuntu-latest, macos-latest] # FIXME: macos + playwright is very unstable.
os: [ubuntu-latest]
runner: [playwright]
browser: [chrome]
steps:
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: core-build-${{ runner.os }}
path: ./dist/
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: pyodide-env
python-version: "3.11"
channels: conda-forge
- name: install test requirements
shell: bash -l {0}
run: |
pip install -r requirements.txt
pip install -e ./pyodide-build
python -m playwright install
- 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/ \
-v \
--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-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@v3
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