Skip to content

Test suite + set_spike_extraction #136

Test suite + set_spike_extraction

Test suite + set_spike_extraction #136

Workflow file for this run

name: Tests
on:
push:
branches:
- 'master'
- 'releases/**'
pull_request:
branches:
- master
defaults:
run:
shell: bash
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/ruff-action@v3
with:
args: check
src: pycbsdk/src
- uses: astral-sh/ruff-action@v3
with:
args: format --check
src: pycbsdk/src
test:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {name: "windows-x64", os: "windows-2022", cmake_extra: "-T v142,host=x86"}
- {name: "macOS-latest", os: "macOS-latest"}
- {name: "ubuntu-latest", os: "ubuntu-latest"}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0 # setuptools-scm needs tags
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v6
# Single build: tests + shared library
- name: Configure
run: |
cmake -B build -S . \
-DCBSDK_BUILD_CBMEX=OFF \
-DCBSDK_BUILD_CBOCT=OFF \
-DCBSDK_BUILD_TEST=ON \
-DCBSDK_BUILD_SAMPLE=OFF \
-DCBSDK_BUILD_SHARED=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install \
${{ matrix.config.cmake_extra }}
- name: Build
run: cmake --build build --config Release -j
# C++ unit tests (fast, no device needed)
- name: Unit Tests
run: >
ctest --test-dir build --build-config Release --output-on-failure
-E "^(device|integration)\."
# Diagnose nPlayServer startup (temporary)
- name: Debug nPlayServer
if: runner.os == 'Windows'
shell: bash
run: |
set -x
NPLAY=$(find build/tests/integration/_nplay_cache -name 'nPlayServer.exe' | head -1)
NS6=$(find build/tests/integration/_nplay_cache -name '*.ns6' | head -1)
echo "Binary: $NPLAY"
echo "NS6: $NS6"
ls -la "$NS6"
# Try with the actual args the fixture uses
timeout 5 "$NPLAY" -V --lockfile test_lock -A "$NS6" 2>&1 || true
# Try without plugins in case nspext_default is missing
timeout 5 "$NPLAY" -V --plugins noplugins --lockfile test_lock -A "$NS6" 2>&1 || true
# Try without autostart to see if it stays alive
timeout 5 "$NPLAY" -V --plugins noplugins --lockfile test_lock2 -n 2>&1 || true
# C++ integration tests (nPlayServer downloaded at configure time)
- name: Integration Tests
run: >
ctest --test-dir build --build-config Release --output-on-failure
-R "^integration\."
timeout-minutes: 10
# pycbsdk tests (reuse the shared library from the same build)
- name: Install shared library
run: cmake --install build --config Release
- name: Set library path
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "CBSDK_LIB_DIR=${{ github.workspace }}/install/bin" >> "$GITHUB_ENV"
else
echo "CBSDK_LIB_DIR=${{ github.workspace }}/install/lib" >> "$GITHUB_ENV"
fi
- name: Install pycbsdk
working-directory: pycbsdk
run: uv sync
- name: pycbsdk Tests
working-directory: pycbsdk
run: uv run pytest tests/ -m integration --timeout=120 -v
timeout-minutes: 10