Skip to content

Implement Pyraview C Engine with Python/Matlab Wrappers #5

Implement Pyraview C Engine with Python/Matlab Wrappers

Implement Pyraview C Engine with Python/Matlab Wrappers #5

name: Build and Release Pyraview
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
workflow_dispatch: # Allows manual triggering
jobs:
build_and_test:
name: Build & Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup CMake
uses: lukka/get-cmake@latest
- name: Configure CMake
run: |
mkdir build
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
- name: Build C Core
run: cmake --build build --config Release
- name: Run C Tests
run: |
cd build
ctest --output-on-failure
# Zip binaries for release (naming by OS/Architecture)
- name: Package Binaries
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
mkdir -p dist
if [ "${{ runner.os }}" == "Windows" ]; then
# Windows CMake builds output to Debug/Release subdirs
zip -j dist/pyraview-win-x64.zip build/Release/*.dll build/Release/*.exe
elif [ "${{ runner.os }}" == "macOS" ]; then
zip -j dist/pyraview-mac-arm.zip build/*.dylib build/tests/run_tests
else
zip -j dist/pyraview-linux-x64.zip build/*.so build/tests/run_tests
fi
- name: Upload Artifacts
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.os }}
path: dist/*
build-matlab:
name: Build & Test Matlab (${{ matrix.os }})
needs: build_and_test
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Matlab actions support limited OS versions, check availability
os: [ubuntu-latest, windows-latest, macos-13]
steps:
- uses: actions/checkout@v4
- uses: matlab-actions/setup-matlab@v2
with:
release: 'R2024b'
- name: Compile MEX
uses: matlab-actions/run-command@v2
with:
command: mex -v src/matlab/pyraview_mex.c src/c/pyraview.c -Iinclude -output src/matlab/pyraview
- name: Run Matlab Tests
uses: matlab-actions/run-tests@v2
with:
select-by-folder: src/matlab
release:
name: Create GitHub Release
needs: build_and_test
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write # Required to create releases
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: release-assets/*
name: Release ${{ github.ref_name }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}