From b2d469b80d82d7a064525b1ee015cf9860fea12b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 14 Oct 2026 21:21:33 +0000 Subject: [PATCH] ci: build an Intel Mac MEX (mexmaci64) with Intel MATLAB under Rosetta The macOS MEX was only built on the arm64 runner, so releases carried pyraview.mexmaca64 but no pyraview.mexmaci64: the toolbox had no binary for Intel-Mac MATLAB and the auto-download fallback had nothing to fetch. There is no Intel macOS runner, but setup-matlab installs the Intel build of releases before R2023b on Apple silicon and runs it under Rosetta 2. Add an R2023a macos-15 entry to the MATLAB matrix in test.yml and release.yml; its mex builds a genuine x86_64 mexmaci64, the MATLAB tests run against it in test.yml, and a lipo check fails the job if it is anything else. The release packages it into the toolbox alongside the others. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01NDx6PbBsjPuycBAhTwC6Ho --- .github/workflows/release.yml | 27 +++++++++++++++++++++++++-- .github/workflows/test.yml | 25 ++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be95083..8605799 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -160,7 +160,7 @@ jobs: if-no-files-found: error build-matlab: - name: Build Matlab MEX (${{ matrix.os }}) + name: Build Matlab MEX (${{ matrix.os }}${{ matrix.intel && ', Intel' || '' }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -176,6 +176,15 @@ jobs: matlab: R2024b - os: macos-15 matlab: R2025a + # Intel Macs need pyraview.mexmaci64, and there is no Intel macOS + # runner. setup-matlab installs the Intel (maci64) build of any + # release before R2023b on an Apple silicon runner and runs it under + # Rosetta 2, so mex there builds and loads a genuine x86_64 MEX. + # R2023a is the newest release that gets the Intel build; MEX files + # are forward compatible, so newer Intel MATLABs load it too. + - os: macos-15 + matlab: R2023a + intel: true steps: - uses: actions/checkout@v4 @@ -249,10 +258,24 @@ jobs: # Run the updated build script which handles paths correctly command: cd('src/matlab'); build_pyraview; + # Fail if the Intel job produced anything but an x86_64 mexmaci64, e.g. + # because the arm64 MATLAB was installed instead of the Intel one. + - name: Check Intel MEX Architecture + if: matrix.intel + shell: bash + run: | + set -e + MEX=src/matlab/+pyraview/pyraview.mexmaci64 + ls -l src/matlab/+pyraview/ + test -f "$MEX" || { echo "$MEX was not built"; exit 1; } + file "$MEX" + ARCHS=$(lipo -archs "$MEX") + [ "$ARCHS" = "x86_64" ] || { echo "$MEX is [$ARCHS], expected [x86_64]"; exit 1; } + - name: Upload MEX Artifact uses: actions/upload-artifact@v4 with: - name: mex-${{ matrix.os }} + name: mex-${{ matrix.os }}${{ matrix.intel && '-intel' || '' }} path: src/matlab/+pyraview/*.mex* # Capture all MEX files in the package if-no-files-found: error diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 09fc7cb..e9e8c22 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -115,7 +115,7 @@ jobs: PYRAVIEW_LIB= python -c "import os, pyraview; assert os.path.dirname(pyraview._lib_path) == os.path.dirname(pyraview.__file__), pyraview._lib_path; print('bundled:', pyraview._lib_path)" build-matlab: - name: Build & Test Matlab (${{ matrix.os }}) + name: Build & Test Matlab (${{ matrix.os }}${{ matrix.intel && ', Intel' || '' }}) needs: build_and_test runs-on: ${{ matrix.os }} strategy: @@ -132,6 +132,15 @@ jobs: matlab: R2024b - os: macos-15 matlab: R2025a + # Intel Macs need pyraview.mexmaci64, and there is no Intel macOS + # runner. setup-matlab installs the Intel (maci64) build of any + # release before R2023b on an Apple silicon runner and runs it under + # Rosetta 2, so mex there builds and loads a genuine x86_64 MEX. + # R2023a is the newest release that gets the Intel build; MEX files + # are forward compatible, so newer Intel MATLABs load it too. + - os: macos-15 + matlab: R2023a + intel: true steps: - uses: actions/checkout@v4 @@ -205,6 +214,20 @@ jobs: # Run the updated build script which handles paths correctly command: cd('src/matlab'); build_pyraview; + # Fail if the Intel job produced anything but an x86_64 mexmaci64, e.g. + # because the arm64 MATLAB was installed instead of the Intel one. + - name: Check Intel MEX Architecture + if: matrix.intel + shell: bash + run: | + set -e + MEX=src/matlab/+pyraview/pyraview.mexmaci64 + ls -l src/matlab/+pyraview/ + test -f "$MEX" || { echo "$MEX was not built"; exit 1; } + file "$MEX" + ARCHS=$(lipo -archs "$MEX") + [ "$ARCHS" = "x86_64" ] || { echo "$MEX is [$ARCHS], expected [x86_64]"; exit 1; } + - name: Run Matlab Tests uses: matlab-actions/run-command@v2 with: