Repository navigation
687 lines (617 loc) · 26.9 KB
/
Copy pathtest.yml
File metadata and controls
687 lines (617 loc) · 26.9 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
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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
name: Tests
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
pre-commit:
name: Pre-commit checks
runs-on: ubuntu-22.04
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Fetch base branch
run: |
git fetch --no-tags origin "${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}"
- name: Run pre-commit checks
run: |
./pre-commit.py --changed-from "origin/${{ github.base_ref }}"
lint:
name: Ruff and ty
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
# Fetch the vendored EEGLAB reference itself, but not EEGLAB's nested
# plugin submodules; upstream EEGLAB can temporarily point at plugin
# commits that are unavailable for shallow GitHub Actions checkout.
submodules: true
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install Python 3.12
run: |
uv python install 3.12
- name: Install BioSig development files
run: sudo apt-get update && sudo apt-get install -y libbiosig-dev
- name: Install dependencies
run: |
uv sync --python 3.12 --all-extras --group dev
- name: Run Ruff lint
run: |
uv run --no-sync ruff check .
- name: Run Ruff format check
run: |
uv run --no-sync ruff format --check .
- name: Run ty type check
run: |
uv run --no-sync ty check
test:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: lint
# Only this job reads the token. The pyodide job installs PyPI packages at run
# time without hash pins, so it and the other jobs must never see it.
env:
# MATLAB batch licensing token (MathWorks pilot, license 1144083, expires
# 2027-01-15). It licenses matlab-batch only, not the Engine API for Python,
# so the parity tests reach MATLAB through tests/matlab/eegprep_batch_engine_serve.m
# running inside matlab-batch (client: tests/matlab_batch_engine.py).
MLM_LICENSE_TOKEN: ${{ secrets.MATLAB_BATCH_TOKEN }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
python-version: ["3.12", "3.13"]
include:
# Test on macOS and Windows for Python 3.12 only
- os: macos-latest
python-version: "3.12"
- os: windows-latest
python-version: "3.12"
steps:
- uses: actions/checkout@v4
with:
# Fetch the vendored EEGLAB reference itself, but not EEGLAB's nested
# plugin submodules; upstream EEGLAB can temporarily point at plugin
# commits that are unavailable for shallow GitHub Actions checkout.
submodules: true
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install Python ${{ matrix.python-version }}
run: |
uv python install ${{ matrix.python-version }}
- name: Install Linux GUI and BioSig libraries
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libbiosig-dev \
libegl1 \
libgl1 \
libxkbcommon-x11-0 \
libxcb-cursor0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-shape0 \
libxcb-xinerama0
echo "QT_QPA_PLATFORM=offscreen" >> "$GITHUB_ENV"
- name: Determine MATLAB availability
id: matlab-availability
shell: bash
run: |
# Skip MATLAB on macOS and Windows, only enable on Ubuntu if token available
if [[ "${{ matrix.os }}" == "ubuntu-22.04" ]] && [[ -n "$MLM_LICENSE_TOKEN" ]]; then
available=true
else
available=false
fi
echo "available=${available}" >> "$GITHUB_OUTPUT"
echo "EEGPREP_SKIP_MATLAB=1" >> "$GITHUB_ENV"
- name: Install BioSig development files on macOS
if: runner.os == 'macOS'
run: |
brew install biosig
echo "C_INCLUDE_PATH=$(brew --prefix biosig)/include" >> "$GITHUB_ENV"
echo "LIBRARY_PATH=$(brew --prefix biosig)/lib" >> "$GITHUB_ENV"
- name: Install dependencies
run: |
uv sync --python ${{ matrix.python-version }} --all-extras --group dev
- name: Set up MATLAB
if: steps.matlab-availability.outputs.available == 'true'
uses: matlab-actions/setup-matlab@v2
with:
release: R2024b
# EEGLAB's reference functions need resample/firls/pwelch and the
# statistics functions (tcdf, ttest, kmeans, ...).
products: >-
MATLAB
Signal_Processing_Toolbox
Statistics_and_Machine_Learning_Toolbox
- name: Locate MATLAB root
if: steps.matlab-availability.outputs.available == 'true'
shell: bash
run: |
MATLAB_ROOT=$(python - <<'PY'
import os
from pathlib import Path
tool_cache = Path(os.environ.get("RUNNER_TOOL_CACHE", "")) / "MATLAB"
candidates = sorted(tool_cache.glob("*/x64"))
if not candidates:
raise SystemExit(f"No MATLAB installation found under {tool_cache}")
print(candidates[-1])
PY
)
echo "MATLAB_ROOT=$MATLAB_ROOT" >> $GITHUB_ENV
echo "$MATLAB_ROOT/bin" >> $GITHUB_PATH
- name: Fetch EEGLAB plugin submodules
if: steps.matlab-availability.outputs.available == 'true'
shell: bash
working-directory: src/eegprep/eeglab
run: |
# One plugin at a time: a missing upstream commit costs one plugin, not the lane.
for path in $(git config -f .gitmodules --get-regexp path | awk '{print $2}'); do
if ! git submodule update --init --recursive --depth 1 -- "$path"; then
echo "::warning title=EEGLAB plugin unavailable::Could not fetch $path; parity tests needing it will fail"
fi
done
- name: Start MATLAB through matlab-batch
id: matlab-batch
if: steps.matlab-availability.outputs.available == 'true'
shell: bash
run: |
BATCH_DIR="$RUNNER_TEMP/eegprep-matlab-batch"
mkdir -p "$BATCH_DIR"
nohup matlab-batch "addpath('$GITHUB_WORKSPACE/tests/matlab'); eegprep_batch_engine_serve('$BATCH_DIR')" \
> "$BATCH_DIR/server.log" 2>&1 &
echo $! > "$BATCH_DIR/server.pid"
for i in $(seq 1 180); do
[[ -f "$BATCH_DIR/ready" ]] && break
if ! kill -0 "$(cat "$BATCH_DIR/server.pid")" 2>/dev/null; then break; fi
sleep 2
done
if [[ ! -f "$BATCH_DIR/ready" ]]; then
echo "::error title=MATLAB did not start::see server.log below"
cat "$BATCH_DIR/server.log"
exit 1
fi
echo "EEGPREP_MATLAB_BATCH_DIR=$BATCH_DIR" >> "$GITHUB_ENV"
echo "EEGPREP_SKIP_MATLAB=0" >> "$GITHUB_ENV"
- name: Run Python tests
# The E1 report runs in its own job below, so this job keeps its length. One line: Windows runs this in PowerShell.
# The suite takes about 15 minutes; a hang, such as a dialog nothing answers, would
# otherwise run until GitHub's 6 hour job limit.
timeout-minutes: 45
run: |
uv run --no-sync pytest tests --deselect tests/test_pop_runica_pamica.py::test_e1_reports_pamica_against_amica_on_the_sample_recording
- name: Stop MATLAB
if: always() && steps.matlab-batch.outcome == 'success'
shell: bash
run: |
touch "$EEGPREP_MATLAB_BATCH_DIR/quit"
for i in $(seq 1 30); do
kill -0 "$(cat "$EEGPREP_MATLAB_BATCH_DIR/server.pid")" 2>/dev/null || break
sleep 1
done
echo "--- matlab-batch server log (tail)"
tail -n 60 "$EEGPREP_MATLAB_BATCH_DIR/server.log" | grep -v "$MLM_LICENSE_TOKEN" || true
# eegprep-lean is a second distribution in this repo (ADR 0069) and the root
# suite's `testpaths = ["tests"]` does not reach it, so without this step it ships
# with lint as its only gate. Run from its own directory so its pyproject supplies
# the `network` marker, with src on the path because the package is deliberately
# not installed into this environment: it must keep working with no dependencies.
# The network tier is excluded here and runs in lean-live.yml on a schedule, so a
# NEMAR outage cannot turn every unrelated pull request red.
- name: Run eegprep-lean tests
if: always()
working-directory: packages/eegprep-lean
env:
PYTHONPATH: src
shell: bash
run: |
uv run --no-sync --project ../.. pytest tests -m "not network"
# The store and window modules need the zarr extra, and skip without it, so the
# step above proves only that they skip. This installs it so they actually run.
# zarr is not added to the dev environment because the base install must keep
# working with nothing present, which the step above is what verifies.
- name: Run eegprep-lean tests with the zarr extra
if: always()
working-directory: packages/eegprep-lean
# bash on every OS, as the steps above do. The default shell on windows-latest
# is PowerShell, where a trailing backslash is not a line continuation but a
# command to run, and `Failed to spawn: \` is the only clue you get -- printed
# after a fully green test run.
shell: bash
run: |
uv run --isolated --with 'zarr==3.4.0' --with pytest \
python -m pytest tests -m "not network" -p no:cacheprovider
# And the plot extra on its own, not alongside zarr. window.py imports zarr inside
# read_window rather than at module scope precisely so this tier stands alone, and
# a stray module-scope import would otherwise only show up in a browser, where the
# zarr install is the awkward one.
- name: Run eegprep-lean tests with the plot extra
if: always()
working-directory: packages/eegprep-lean
shell: bash
run: |
uv run --isolated --with matplotlib --with pytest \
python -m pytest tests -m "not network" -p no:cacheprovider
# Both extras, which is the install a real session has. The three tiers above each
# prove a tier stands alone; this one is the only place the cross-extra paths run,
# such as reading a window and then plotting it.
- name: Run eegprep-lean tests with both extras
if: always()
working-directory: packages/eegprep-lean
shell: bash
run: |
uv run --isolated --with 'zarr==3.4.0' --with matplotlib --with pytest \
python -m pytest tests -m "not network" -p no:cacheprovider
- name: Display installed packages
if: always()
run: |
uv pip list
# E1 compares pamica with the shipped AMICA binary on the sample recording and prints one line. It asserts
# nothing about the numbers: the binary seeds its random start from the clock, so they vary between runs.
# The binary launches on the macOS runner (x86_64 under Rosetta) and not on the ubuntu-22.04 or Windows
# runners, so this job runs on macOS and fails only if the binary cannot launch.
e1-report:
name: E1 report (macOS)
runs-on: macos-latest
needs: lint
timeout-minutes: 90
env:
EEGPREP_REQUIRE_AMICA: "1"
EEGPREP_SKIP_MATLAB: "1"
steps:
- uses: actions/checkout@v4
with:
# Same checkout as the test job: the vendored EEGLAB reference, without its nested plugin submodules.
submodules: true
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install Python 3.12
run: |
uv python install 3.12
- name: Install BioSig development files on macOS
run: |
brew install biosig
echo "C_INCLUDE_PATH=$(brew --prefix biosig)/include" >> "$GITHUB_ENV"
echo "LIBRARY_PATH=$(brew --prefix biosig)/lib" >> "$GITHUB_ENV"
- name: Install dependencies
run: |
uv sync --python 3.12 --all-extras --group dev
- name: Print the E1 line
run: |
uv run --no-sync pytest tests/test_pop_runica_pamica.py::test_e1_reports_pamica_against_amica_on_the_sample_recording -v
# A plain `pip install eegprep` has no brackets. It must load, clean, and plot
# the sample recording. Octave, MNE, PyBIDS, Picard, ONNX Runtime, and PyTorch stay out of this job.
base-install:
name: Base install without optional extras
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install Python 3.12
run: uv python install 3.12
- name: Install the base package with no extras
run: |
uv venv --python 3.12 /tmp/eegprep-base
uv pip install --python /tmp/eegprep-base/bin/python .
uv pip install --python /tmp/eegprep-base/bin/python pytest pytest-timeout
- name: Clean and plot the sample recording
env:
MPLBACKEND: Agg
EEGPREP_SKIP_MATLAB: "1"
run: |
/tmp/eegprep-base/bin/python - <<'PY'
import importlib.util
import io
import sys
import eegprep
from eegprep import clean_artifacts, pop_loadset, topoplot
absent = [
name
for name in ("oct2py", "mne", "bids", "picard", "onnxruntime", "torch")
if importlib.util.find_spec(name) is not None
]
if absent:
raise SystemExit(f"base install includes {absent}")
missing = [
name
for name in ("numpy", "scipy", "matplotlib", "psutil", "pyedflib", "h5py")
if importlib.util.find_spec(name) is None
]
if missing:
raise SystemExit(f"base install is missing {missing}")
names = dir(eegprep)
if "pop_loadset" not in names or "help" not in names or "clean_artifacts" not in names:
raise SystemExit("dir() is missing public names")
loaded = [name for name in ("mne", "oct2py", "bids", "picard") if name in sys.modules]
if loaded:
raise SystemExit(f"import eegprep loaded {loaded}")
buffer = io.StringIO()
sys.stdout = buffer
eegprep.help()
sys.stdout = sys.__stdout__
text = buffer.getvalue()
if "pop_loadset" not in text or 'pip install "eegprep[full]"' not in text:
raise SystemExit("help() did not describe the public names and extras")
eeg = pop_loadset("sample_data/eeglab_data.set")
cleaned, *_rest = clean_artifacts(eeg)
figure, *_plot = topoplot(cleaned["data"][:, 0], cleaned["chanlocs"])
image = io.BytesIO()
figure.savefig(image, format="png")
if not image.getvalue():
raise SystemExit("topoplot wrote an empty figure")
leaked = [name for name in ("mne", "oct2py", "bids", "picard") if name in sys.modules]
if leaked:
raise SystemExit(f"the base pipeline loaded {leaked}")
print(f"base pipeline ok; cleaned shape {cleaned['data'].shape}; png {len(image.getvalue())} bytes")
PY
/tmp/eegprep-base/bin/python -m pytest \
tests/test_package_help.py tests/test_optional_extras.py tests/test_browser_dependency_floors.py \
-q -p no:cacheprovider
pyodide:
name: Pyodide harness, ICA benchmark, ICLabel browser parity, and ICLabel regeneration
runs-on: ubuntu-22.04
needs: lint
# The job took 46 to 77 minutes in recorded runs; the bound is 1.5 times the longest.
timeout-minutes: 120
# No secret, a read-only token and no stored Git credential: the harness
# installs PyPI packages at run time without hash pins.
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
# tools/pyodide/run_pyodide.sh installs the pinned Pyodide and ONNX Runtime
# Web packages with `bun install --frozen-lockfile` from tools/pyodide/bun.lock;
# Node.js above still runs the harness.
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.4.2
- name: Install Python 3.12
run: |
uv python install 3.12
- name: Install benchmark and ICLabel regeneration dependencies
run: |
uv sync --python 3.12 --group dev --extra torch
- name: Build EEGPrep wheel from the working tree
run: |
mkdir -p pyodide-artifacts
uv build --wheel --out-dir pyodide-artifacts
# The documented regeneration sequence from tools/iclabel/quantize_iclabel_onnx.py:
# export the float32 network from netICL.mat, require its outputs to match the
# shipped iclabel.onnx on the evaluation features, quantize it, and require the
# gate to pass against the frozen teacher probabilities and the result to be
# numerically identical to the shipped iclabel_int8.onnx on the evaluation
# features. A fresh PyTorch export is not guaranteed to be byte-identical across
# PyTorch versions, so bytes are not compared. The regenerated report's gate and
# metrics must match the committed report (drift metrics within 1e-5 for
# CPU differences), and the committed report must record the shipped int8
# model's SHA-256, which release.yml checks again.
- name: Regenerate the ICLabel models from netICL.mat
run: |
set -euo pipefail
regenerated="$RUNNER_TEMP/iclabel-regenerated"
uv run --no-sync python tools/iclabel/export_iclabel_onnx.py \
--onnx-path "$regenerated/iclabel_float32.onnx"
uv run --no-sync python tools/iclabel/quantize_iclabel_onnx.py \
--float32-artifact "$regenerated/iclabel_float32.onnx" \
--output "$regenerated/iclabel_int8.onnx" \
--report "$regenerated/parity_report.json" \
--require-float32-close-to src/eegprep/plugins/ICLabel/iclabel.onnx \
--require-identical-to src/eegprep/plugins/ICLabel/iclabel_int8.onnx \
--require-matching-report tools/iclabel/parity_report.json \
> pyodide-artifacts/iclabel-quantization.log
shipped_sha256=$(sha256sum src/eegprep/plugins/ICLabel/iclabel_int8.onnx | cut -d' ' -f1)
recorded_sha256=$(python3 -c 'import json; print(json.load(open("tools/iclabel/parity_report.json"))["packaged_model"]["sha256"])')
if [ "$shipped_sha256" != "$recorded_sha256" ]; then
echo "::error::tools/iclabel/parity_report.json does not describe the shipped iclabel_int8.onnx; regenerate them together"
exit 1
fi
- name: Validate Node runner argument handling
run: |
if output=$(node tools/pyodide/run_pyodide.mjs --not-a-real-option 2>&1); then
echo "The runner accepted an invalid option" >&2
exit 1
fi
grep -q "Usage:" <<< "$output"
- name: Run Pyodide sample-data smoke test
run: |
set -o pipefail
tools/pyodide/run_pyodide.sh \
--wheel "$(find pyodide-artifacts -maxdepth 1 -type f -name '*.whl' -print -quit)" \
--script tools/pyodide/smoke.py \
--sample-data-dir sample_data \
2>&1 | tee pyodide-artifacts/pyodide-smoke.log
- name: Run native ICLabel parity reference
env:
MNE_CONFIGDIR: ${{ runner.temp }}/mne
run: |
uv run --no-sync python tools/pyodide/iclabel_parity.py \
--platform native \
--sample-data-dir sample_data \
> pyodide-artifacts/iclabel-native.json
- name: Run browser ICLabel parity through Pyodide
run: |
set -o pipefail
tools/pyodide/run_pyodide.sh \
--iclabel-web \
--wheel "$(find pyodide-artifacts -maxdepth 1 -type f -name '*.whl' -print -quit)" \
--script tools/pyodide/iclabel_parity.py \
--sample-data-dir sample_data \
--output pyodide-artifacts/iclabel-pyodide.json \
-- --platform pyodide \
2>&1 | tee pyodide-artifacts/iclabel-pyodide.log
- name: Compare ICLabel browser parity
run: |
set -o pipefail
uv run --no-sync python tools/pyodide/compare_iclabel.py \
--native pyodide-artifacts/iclabel-native.json \
--pyodide pyodide-artifacts/iclabel-pyodide.json \
--report pyodide-artifacts/iclabel-parity.md \
| tee pyodide-artifacts/iclabel-parity.json
- name: Run native ICA and matmul benchmark
env:
MNE_CONFIGDIR: ${{ runner.temp }}/mne
OMP_NUM_THREADS: "1"
OPENBLAS_NUM_THREADS: "1"
MKL_NUM_THREADS: "1"
VECLIB_MAXIMUM_THREADS: "1"
NUMEXPR_NUM_THREADS: "1"
run: |
uv run --no-sync python tools/pyodide/benchmark.py \
--platform native \
> pyodide-artifacts/benchmark-native.json
- name: Run Pyodide ICA and matmul benchmark
run: |
set -o pipefail
tools/pyodide/run_pyodide.sh \
--wheel "$(find pyodide-artifacts -maxdepth 1 -type f -name '*.whl' -print -quit)" \
--script tools/pyodide/benchmark.py \
--output pyodide-artifacts/benchmark-pyodide.json \
-- --platform pyodide \
2>&1 | tee pyodide-artifacts/benchmark-pyodide.log
- name: Compare benchmark gates
run: |
set -o pipefail
uv run --no-sync python tools/pyodide/compare_benchmarks.py \
--native pyodide-artifacts/benchmark-native.json \
--pyodide pyodide-artifacts/benchmark-pyodide.json \
--report pyodide-artifacts/benchmark-comparison.md \
| tee pyodide-artifacts/benchmark-comparison.json
- name: Upload Pyodide raw output
if: always()
uses: actions/upload-artifact@v4
with:
name: pyodide-harness-output
path: pyodide-artifacts
# No continue-on-error, so the job fails on any new failure or strict XPASS.
# Maintainers should mark it required in branch protection. Known Python gaps
# are individual strict xfails. GUI and slow contracts stay out because modal
# Qt dialogs hang under offscreen Qt and the slow set exceeds this lane.
# This lane deselects MATLAB-oracle unittest classes; they are not Python gaps.
eeglab-python:
name: EEGLAB Python backend
runs-on: ubuntu-22.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install Python 3.12
run: |
uv python install 3.12
- name: Install Linux GUI and BioSig libraries
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
git-lfs \
libbiosig-dev \
libegl1 \
libgl1 \
libxkbcommon-x11-0 \
libxcb-cursor0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-shape0 \
libxcb-xinerama0
echo "QT_QPA_PLATFORM=offscreen" >> "$GITHUB_ENV"
- name: Install dependencies
run: |
uv sync --python 3.12 --all-extras --group dev
- name: Read pinned EEGLAB test commits
id: pins
run: |
uv run --no-sync python - <<'PY'
import os
from tests.eeglab_tests import (
EEGLAB_TESTS_COMMIT,
EEGLAB_TESTS_EEGLAB_COMMIT,
EEGLAB_TESTS_REPOSITORY,
)
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as handle:
handle.write(f"suite-commit={EEGLAB_TESTS_COMMIT}\n")
handle.write(f"eeglab-commit={EEGLAB_TESTS_EEGLAB_COMMIT}\n")
handle.write(f"suite-repository={EEGLAB_TESTS_REPOSITORY}\n")
PY
- name: Checkout eeglab_tests
env:
SUITE_COMMIT: ${{ steps.pins.outputs.suite-commit }}
EEGLAB_COMMIT: ${{ steps.pins.outputs.eeglab-commit }}
SUITE_REPOSITORY: ${{ steps.pins.outputs.suite-repository }}
run: |
rm -rf eeglab_tests
git init eeglab_tests
git -C eeglab_tests remote add origin "$SUITE_REPOSITORY"
git -C eeglab_tests fetch --depth 1 origin "$SUITE_COMMIT"
git -C eeglab_tests checkout --detach FETCH_HEAD
if [[ "$(git -C eeglab_tests rev-parse HEAD)" != "$SUITE_COMMIT" ]]; then
echo "::error title=eeglab_tests pin mismatch::HEAD is not $SUITE_COMMIT"
exit 1
fi
git -C eeglab_tests submodule set-url eeglab https://github.com/sccn/eeglab.git
git -C eeglab_tests submodule sync -- eeglab
git -C eeglab_tests submodule update --init --depth 1 -- eeglab
if [[ "$(git -C eeglab_tests/eeglab rev-parse HEAD)" != "$EEGLAB_COMMIT" ]]; then
echo "::error title=EEGLAB pin mismatch::suite submodule is not $EEGLAB_COMMIT"
exit 1
fi
git -C eeglab_tests lfs install --local
git -C eeglab_tests lfs pull
# The working tree already holds the smudged files. The LFS cache copies them again.
rm -rf eeglab_tests/.git/lfs
- name: Run EEGLAB Python backend tests
run: |
uv run --no-sync pytest tests \
--eeglab-backend python \
--eeglab-suite-root "$GITHUB_WORKSPACE/eeglab_tests" \
-m "parity and not slow and not gui" \
--timeout=600 \
--timeout-method=signal