Skip to content

Fixup paths in demo for distribution #80

Fixup paths in demo for distribution

Fixup paths in demo for distribution #80

Workflow file for this run

name: Toast MATLAB MEX
on:
pull_request:
types: [assigned, opened, synchronize, reopened]
push:
branches: [master]
jobs:
build_mex:
name: Build MEX on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macos-13, macos-14]
steps:
- uses: actions/checkout@v3
# Get MATLAB
- name: Set up MATLAB (R2023b for Apple Silicon)
if: matrix.os == 'macos-14'
uses: matlab-actions/setup-matlab@v2
with:
release: R2023b
- name: Set up MATLAB (R2022a)
if: matrix.os != 'macos-14'
uses: matlab-actions/setup-matlab@v2
with:
release: R2022a
- uses: apple-actions/import-codesign-certs@v3
if: matrix.os == 'macos-14' || matrix.os == 'macos-13'
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATES_P12 }}
p12-password: ${{ secrets.APPLE_CERTIFICATES_P12_PASSWORD }}
# Build the MEX
- name: Build
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
export CC=gcc-10
export CXX=g++-10
fi
mkdir build
cd build
cmake ../
cmake --build . --target install --config Release
# Fix the RPATH on MacOS (without this, the rpath is set to the absolute directory of the runners and
# libraries such as libMatlabEngine.dylib cannot be referenced
- name: Fix RPATH
if: matrix.os == 'macos-14' || matrix.os == 'macos-13'
run: |
MEX_FILE=$(ls dist/matlab/toast/*.mex*)
install_name_tool -add_rpath @executable_path/../../extern/bin/maca64 ${MEX_FILE}
# Code sign and archive on MacOS
- name: Code sign, archive and notarize
if: matrix.os == 'macos-14' || matrix.os == 'macos-13'
env:
APPLE_CODESIGN_IDENTITY: ${{ secrets.APPLE_CODESIGN_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
RUNNER_OS: ${{ runner.os }}
RUNNER_ARCH: ${{ runner.arch }}
run: |
MEX_FILE=$(ls dist/matlab/toast/*.mex*)
codesign --deep --force --verify --verbose --timestamp --sign "${APPLE_CODESIGN_IDENTITY}" --options runtime ${MEX_FILE}
zip -r toastmm-matlab-${RUNNER_OS}-${RUNNER_ARCH}-mex.zip ${MEX_FILE}
xcrun notarytool submit --wait --apple-id "${APPLE_ID}" --team-id "${APPLE_TEAM_ID}" --password "${APPLE_ID_PASSWORD}" toastmm-matlab-${RUNNER_OS}-${RUNNER_ARCH}-mex.zip
# Archive and upload
- uses: actions/upload-artifact@v3
with:
name: toastmm-matlab-${{ runner.os }}-${{ runner.arch }}
path: |
dist/matlab