Pseudo Online evaluation and dataset conversion (#641) #1448
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 ] | |
| 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-${{ github.run_id }} | |
| 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() | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ~/mne_data | |
| key: ${{ runner.os }}-mne-data-v2-${{ github.run_id }} |