Skip to content

Sign and notarise MacOS MEX #62

Sign and notarise MacOS MEX

Sign and notarise MacOS MEX #62

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
# 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: |
security find-identity
codesign --deep --force --verify --verbose --timestamp --sign "${APPLE_CODESIGN_IDENTITY}" --options runtime dist/matlab/toast/*.mex*
cd dist/matlab
zip -r toastmm-matlab-${RUNNER_OS}-${RUNNER_ARCH}.zip *
xcrun notarytool submit --wait --apple-id ${APPLE_ID} --team-id ${APPLE_TEAM_ID} --password ${APPLE_ID_PASSWORD} toastmm-matlab-${RUNNER_OS}-${$UNNER_ARCH}.zip
xcrun stapler staple -v toastmm-matlab-${RUNNER_OS}-${RUNNER_ARCH}.zip
- uses: actions/upload-artifact@v3
if: matrix.os == 'macos-14' || matrix.os == 'macos-13'
with:
name: toastmm-matlab-${{ runner.os }}-${{ runner.arch }}
path: |
dist/matlab/toastmm-matlab-${{ runner.os }}-${{ runner.arch }}.zip
- uses: actions/upload-artifact@v3
if: matrix.os != 'macos-14' && matrix.os != 'macos-13'
with:
name: toastmm-matlab-${{ runner.os }}-${{ runner.arch }}
path: |
dist/matlab