-
Notifications
You must be signed in to change notification settings - Fork 26
304 lines (262 loc) · 9.97 KB
/
main.yml
File metadata and controls
304 lines (262 loc) · 9.97 KB
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
name: CI
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, labeled]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 3
# Increase this value to reset cache if emscripten_version has not changed
EMSDK_CACHE_FOLDER: "emsdk-cache"
EMSDK_CACHE_NUMBER: 0
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# include tags so that hatch-vcs can infer the version
fetch-depth: 0
# switch to fetch-tags: true when the following is fixed
# see https://github.com/actions/checkout/issues/2041
# fetch-tags: true
- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.13"
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[resolve]" --group test
- name: Run tests
run: |
pytest \
--junitxml=test-results/junit.xml \
--cov=pyodide-build \
pyodide_build \
-m "not integration"
- name: Upload coverage
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-no-integration-${{ matrix.os }}
path: .coverage
if-no-files-found: error
include-hidden-files: true
windows-integration-test:
runs-on: windows-latest
needs: [check-integration-test-trigger]
if: needs.check-integration-test-trigger.outputs.run-integration-test
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.13"
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
- name: Install package
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Install xbuildenv and emscripten
run: |
pyodide xbuildenv install
pyodide xbuildenv install-emscripten
- name: Test emcc
run: |
$EMSDK_DIR = pyodide config get emsdk_dir
. "$EMSDK_DIR\emsdk_env.ps1"
$code = @"
#include <stdio.h>
int main() {
printf("emcc works\n");
return 0;
}
"@
$code | Out-File test.c
emcc test.c -o test.js
node test.js
check-integration-test-trigger:
name: test-integration-test-trigger
runs-on: ubuntu-latest
outputs:
run-integration-test: ${{ steps.check-integration-test-trigger.outputs.trigger }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- id: check-integration-test-trigger
name: Check integration test trigger
shell: bash
run: |
set -e -x
COMMIT_MSG=$(git log --no-merges -1 --oneline)
# The integration tests will be triggered on push or on pull_request, when:
# the commit message contains "[integration]", or
# if it is pushed to main branch, or
# if the PR has the "integration" label.
if [[ "$GITHUB_EVENT_NAME" == push && "$GITHUB_REF" == refs/heads/main ||
"$COMMIT_MSG" =~ \[integration\] ||
"${{ contains(github.event.pull_request.labels.*.name, 'integration') }}" == "true" ]]; then
echo "trigger=true" >> "$GITHUB_OUTPUT"
fi
integration-test:
name: integration-test (${{ matrix.task.name }}, ${{ matrix.task.installer }}, ${{ matrix.pyodide-version }}-pyodide, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: [check-integration-test-trigger]
strategy:
fail-fast: false
matrix:
task: [
{ name: test-recipe, installer: pip },
{ name: test-src, installer: pip },
{ name: test-recipe, installer: uv },
{ name: test-src, installer: uv },
{ name: test-integration-marker, installer: pip }, # installer doesn't matter
]
# os: [ubuntu-latest, macos-latest] # FIXME: https://github.com/oracle/graal/issues/11855
os: [ubuntu-latest]
pyodide-version: [stable]
include:
# Run no-isolation tests and Pyodide minimum version testing only
# for the pip installer and on Linux
- task: {name: test-src-no-isolation, installer: pip} # installer doesn't matter
os: ubuntu-latest
- task: { name: test-recipe, installer: pip }
os: ubuntu-latest
pyodide-version: minimum
- task: { name: test-src, installer: pip }
os: ubuntu-latest
pyodide-version: minimum
if: needs.check-integration-test-trigger.outputs.run-integration-test
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# include tags so that hatch-vcs can infer the version
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.13"
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
- name: Install the package
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[uv]" --group test
- name: Install xbuildenv
run: |
if [[ "${{ matrix.pyodide-version }}" == "minimum" ]]; then
MIN_VERSION=$(pyodide xbuildenv search --json | jq -r '.environments | sort_by(.version) | .[0].version')
echo "Installing Pyodide xbuildenv version: $MIN_VERSION"
pyodide xbuildenv install $MIN_VERSION
else
pyodide xbuildenv install
fi
echo EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) >> $GITHUB_ENV
- name: Get number of cores on the runner
id: get-cores
run: echo "CORES=$(nproc)" >> $GITHUB_OUTPUT
- name: Run tests marked with integration
if: matrix.task.name == 'test-integration-marker'
run: |
pytest --junitxml=test-results/junit.xml --cov=pyodide-build pyodide_build -m "integration"
- name: Run the recipe integration tests (${{ matrix.task.name }})
if: matrix.task.name != 'test-integration-marker'
env:
PYODIDE_JOBS: ${{ steps.get-cores.outputs.CORES }}
working-directory: integration_tests
run: |
# https://github.com/pyodide/pyodide-build/issues/147
# disable package with scikit-build-core
if [[ ${{ matrix.os }} == "macos-latest" ]]; then
export RECIPE_BUILD_TARGET="*,!boost-histogram"
fi
if [[ "${{ matrix.task.installer }}" == "uv" ]]; then
export UV_RUN_PREFIX="uv run"
fi
make ${{ matrix.task.name }}
- name: Upload coverage for tests marked with integration
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: matrix.task.name == 'test-integration-marker'
with:
name: coverage-from-integration-${{ matrix.os }}
path: .coverage
if-no-files-found: error
include-hidden-files: true
test-venv:
name: test-venv (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: [check-integration-test-trigger]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
if: needs.check-integration-test-trigger.outputs.run-integration-test
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.13"
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
- name: Install the package
run: |
python -m pip install --upgrade pip
python -m pip install -e . --group test
- name: Install xbuildenv
run: pyodide xbuildenv install
- name: Run venv test
working-directory: integration_tests
shell: bash -l {0}
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cmd //c scripts\\pyodide_venv_test.bat
else
./scripts/pyodide_venv_test.sh
fi
coverage:
name: Collect and upload coverage
runs-on: ubuntu-latest
needs: [test, integration-test]
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: coverage_files
pattern: coverage-*
merge-multiple: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.13"
- name: Combine coverage files
run: pipx install coverage && coverage combine --append coverage_files/**/.coverage
- uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with:
fail_ci_if_error: false
files: .coverage