Skip to content

Update README.md

Update README.md #60

Workflow file for this run

name: Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
env:
# Set MATLAB batch licensing token for private repos or when using MATLAB Engine
MLM_LICENSE_TOKEN: ${{ secrets.MLM_LICENSE_TOKEN }}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
python-version: ["3.10", "3.11", "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:
submodules: 'recursive'
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Determine MATLAB availability
id: matlab-availability
shell: bash
run: |
available=false
echo "available=${available}" >> "$GITHUB_OUTPUT"
if [[ "${available}" == "true" ]]; then
echo "EEGPREP_SKIP_MATLAB=0" >> "$GITHUB_ENV"
else
echo "EEGPREP_SKIP_MATLAB=1" >> "$GITHUB_ENV"
fi
- name: Set up MATLAB
if: steps.matlab-availability.outputs.available == 'true'
uses: matlab-actions/setup-matlab@v2
with:
release: R2024b
products: MATLAB
- 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: Install Python MATLAB Engine
if: steps.matlab-availability.outputs.available == 'true'
shell: bash
run: |
python -m pip install "${MATLAB_ROOT}/extern/engines/python"
- name: Verify MATLAB Engine
if: steps.matlab-availability.outputs.available == 'true'
shell: bash
run: |
python - <<'PY'
import matlab.engine
engine = matlab.engine.start_matlab()
engine.eval("disp('hello world');", nargout=0)
engine.quit()
PY
- name: Install dependencies
run: |
uv pip install --system -e .[all]
- name: Run MATLAB tests
if: steps.matlab-availability.outputs.available == 'true'
uses: matlab-actions/run-command@v2
with:
command: "ver"
- name: Run Python tests
run: |
python -m unittest discover -s tests
- name: Display installed packages
if: always()
run: |
uv pip list --system