-
Notifications
You must be signed in to change notification settings - Fork 250
133 lines (119 loc) · 4.38 KB
/
Copy pathtest.yml
File metadata and controls
133 lines (119 loc) · 4.38 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
name: Test
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
cancel-in-progress: true
on:
push:
branches: [ develop, master ]
pull_request:
branches: [ develop, master ]
env:
# Install CPU-only PyTorch wheels (torch arrives transitively via the
# deeplearning extra -> braindecode). Avoids pulling CUDA builds on CI.
UV_TORCH_BACKEND: cpu
jobs:
test:
name: ${{ matrix.os }}, py-${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
include:
- os: macOS-latest
python-version: "3.12"
- os: windows-latest
python-version: "3.12"
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
# Cache MNE Data
- name: Restore MNE Data Cache
id: cache-mne_data
uses: actions/cache/restore@v4
with:
path: ~/mne_data
key: ${{ runner.os }}-mne-data-v2
restore-keys: |
${{ runner.os }}-mne-data-v2-
- name: Install moabb
run: |
uv pip install -e .[tests,deeplearning,optuna]
- name: Pre-download BNCI datasets (cold cache only)
if: steps.cache-mne_data.outputs.cache-matched-key == ''
run: |
echo "Cache is cold, pre-downloading BNCI datasets..."
python << 'EOF'
import sys
import time
datasets_to_download = [
("moabb.datasets", "BNCI2014_001", None),
("moabb.datasets", "BNCI2015_001", None),
]
failed = []
for module_path, class_name, n_subjects in datasets_to_download:
print(f"\n{'='*60}")
print(f"Pre-downloading {class_name}...")
print(f"{'='*60}")
success = False
for attempt in range(5):
try:
import importlib
module = importlib.import_module(module_path)
cls = getattr(module, class_name)
ds = cls()
subjects = ds.subject_list if n_subjects is None else ds.subject_list[:n_subjects]
ds.download(subject_list=subjects)
print(f"SUCCESS: {class_name} downloaded")
success = True
break
except Exception as e:
print(f"Attempt {attempt + 1}/5 failed: {e}")
if attempt < 4:
wait = 90 * (attempt + 1)
print(f"Waiting {wait}s before retry...")
time.sleep(wait)
if not success:
failed.append(class_name)
print(f"FAILED: {class_name} after 5 attempts")
print("Waiting 60s before next dataset...")
time.sleep(60)
if failed:
print(f"\n{'='*60}")
print(f"ERROR: Failed to download: {', '.join(failed)}")
print(f"{'='*60}")
sys.exit(1)
else:
print(f"\n{'='*60}")
print("All BNCI datasets downloaded successfully!")
print(f"{'='*60}")
EOF
- name: Run tests
run: |
echo "Running tests"
pytest -vv -s --tb=long --durations=0 --log-cli-level=INFO --cov=moabb --cov-report=xml moabb/tests --verbose
- name: Run pipelines
run: |
python -m moabb.run --pipelines=./moabb/tests/test_pipelines/ --verbose
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
if: success()
with:
verbose: true
directory: /home/runner/work/moabb/moabb
files: ./.coverage,coverage.xml
env_vars: OS,PYTHON
- name: Save MNE Data Cache
if: success() && steps.cache-mne_data.outputs.cache-hit != 'true' && github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')
uses: actions/cache/save@v4
with:
path: ~/mne_data
key: ${{ runner.os }}-mne-data-v2