Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/cli-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CLI tests

# Build ("compile") and test the Python command-line tool across Linux,
# Windows, and macOS Apple Silicon (macos-14, running natively on arm64). The
# tests use a fake sonpy shim, so they do not require CED's proprietary
# binaries.

on:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
pull_request:
branches: [ "main" ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: ${{ matrix.os }} / py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest # Linux
python-version: '3.11'
- os: windows-latest # Windows
python-version: '3.11'
- os: macos-14 # macOS Apple Silicon
python-version: '3.11'

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Upgrade build tooling
run: python -m pip install --upgrade pip build

- name: Compile / build the package
run: |
python -m compileall src
python -m build

- name: Install package (without CED sonpy) and test deps
run: |
python -m pip install . --no-deps
python -m pip install numpy pytest

- name: Run CLI tests
run: python -m pytest -q
62 changes: 62 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Integration tests (real sonpy)

# Exercises the REAL CED sonpy binding end-to-end against the checked-in
# example file (example/spike2data.smrx), on every platform.
#
# CED ships sonpy wheels for Python 3.14 on manylinux, macOS and Windows.
# Note: CED's macOS wheel is labelled universal2 but actually contains an
# x86_64-only binary (no native arm64). On Apple Silicon (macos-14) we
# therefore run every Python command through `arch -x86_64`, which executes the
# x86_64 slice of the universal2 python.org interpreter under Rosetta 2 so the
# x86_64 sonpy loads. Other platforms run their native x86_64 Python. (The
# fake-sonpy suites in cli-tests.yml run natively and cover more Python
# versions.)

on:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
pull_request:
branches: [ "main" ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
integration:
name: sonpy / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest # Linux (manylinux wheel)
py: python
- os: windows-latest # Windows
py: python
- os: macos-14 # macOS Apple Silicon -> x86_64 under Rosetta
py: arch -x86_64 python

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python 3.14 (x86_64)
uses: actions/setup-python@v5
with:
python-version: '3.14'
architecture: x64

- name: Install sonpipe with the real CED sonpy
run: |
${{ matrix.py }} -m pip install --upgrade pip
${{ matrix.py }} -m pip install .[test]

- name: Verify sonpy is importable and exposes SonFile
run: ${{ matrix.py }} -c "from sonpipe.sonfile import load_sonpy; m = load_sonpy(); print('sonpy module:', m.__name__, '-> SonFile:', hasattr(m, 'SonFile'))"

- name: Run integration tests against example/spike2data.smrx
run: ${{ matrix.py }} -m pytest -m integration -rs -v
72 changes: 72 additions & 0 deletions .github/workflows/matlab-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: MATLAB tests

# matbox-style CI (mirroring VH-Lab/NDR-matlab) for the +sonpipe MATLAB
# wrappers. Runs the matlab.unittest suite across Linux, Windows, and macOS
# Apple Silicon (macos-14). The MATLAB tests drive a fake sonpipe CLI
# (Python + numpy), so CED's proprietary sonpy binaries are not required.
#
# Licensing: matlab-actions provides MathWorks licensing for free on PUBLIC
# repositories, so no token or secret is needed. (If this repo is kept private,
# MATLAB in CI requires a batch licensing token supplied via the
# MLM_LICENSE_TOKEN environment variable.)

on:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
pull_request:
branches: [ "main" ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: MATLAB / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest # Linux
- windows-latest # Windows
- macos-14 # macOS Apple Silicon

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python (for the fake sonpipe CLI)
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install numpy
run: python -m pip install --upgrade pip numpy

- name: Start virtual display server
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y xvfb
Xvfb :99 &
echo "DISPLAY=:99" >> $GITHUB_ENV

- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v3
with:
release: latest
cache: true

- name: Run MATLAB unit tests
uses: matlab-actions/run-command@v3
with:
command: |
addpath(fullfile(pwd,'matlab'));
addpath(fullfile(pwd,'test'));
results = runtests('sonpipe.unittest', 'OutputDetail', 'Detailed');
disp(table(results));
assert(all(~[results.Failed]), 'Some sonpipe MATLAB tests failed');
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Python
__pycache__/
*.py[cod]
*.egg-info/
.eggs/
build/
dist/
.pytest_cache/
.venv/
venv/
*.so
*.pyd

# MATLAB
*.p
*.asv
*.mex*

# OS / editor
.DS_Store
*.swp
Loading
Loading