Skip to content

Commit 18e28bd

Browse files
andylizfclaude
andauthored
feat: Add macOS 15 support for M4 Mac compatibility (#38)
* feat: add macOS 15 support for M4 Mac compatibility - Add macos-15 CI builds for Python 3.9-3.13 - Update MACOSX_DEPLOYMENT_TARGET from 11.0/13.3 to 14.0 for broader compatibility - Addresses issue #34 with Mac M4 wheel compatibility 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * fix: ensure wheels are compatible with older macOS versions - Set MACOSX_DEPLOYMENT_TARGET=11.0 for HNSW backend (broad compatibility) - Set MACOSX_DEPLOYMENT_TARGET=13.0 for DiskANN backend (required for LAPACK) - Add --require-target-macos-version to delocate-wheel commands - This fixes CI failures on macos-13 runners while maintaining M4 Mac support Fixes the issue where wheels built on macos-14 runners were incorrectly tagged as macosx_14_0, preventing installation on macos-13 runners. * fix: use macOS 13.3 for DiskANN backend as required by LAPACK DiskANN requires macOS 13.3+ for sgesdd_ LAPACK function, so we must use 13.3 as the deployment target, not 13.0. * fix: match deployment target with runner OS for library compatibility The issue is that Homebrew libraries on macOS 14 runners are built for macOS 14 and cannot be downgraded. We must use different deployment targets based on the runner OS: - macOS 13 runners: Can build for macOS 11.0 (HNSW) and 13.3 (DiskANN) - macOS 14 runners: Must build for macOS 14.0 (due to system libraries) This ensures delocate-wheel succeeds by matching the deployment target with the actual minimum version required by bundled libraries. * fix: add macOS 15 support to deployment target configuration The issue extends to macOS 15 runners where Homebrew libraries are built for macOS 15. We must handle all runner versions explicitly: - macOS 13 runners: Can build for macOS 11.0 (HNSW) and 13.3 (DiskANN) - macOS 14 runners: Must build for macOS 14.0 (system libraries) - macOS 15 runners: Must build for macOS 15.0 (system libraries) This ensures wheels are properly tagged for their actual minimum supported macOS version, matching the bundled libraries. * fix: correct macOS deployment targets based on Homebrew library requirements The key insight is that Homebrew libraries on each macOS version are compiled for that specific version: - macOS 13: Libraries require macOS 13.0 minimum - macOS 14: Libraries require macOS 14.0 minimum - macOS 15: Libraries require macOS 15.0 minimum We cannot build wheels for older macOS versions than what the bundled Homebrew libraries require. This means: - macOS 13 runners: Build for macOS 13.0+ (HNSW) and 13.3+ (DiskANN) - macOS 14 runners: Build for macOS 14.0+ - macOS 15 runners: Build for macOS 15.0+ This ensures delocate-wheel succeeds by matching deployment targets with the actual minimum versions required by system libraries. * fix: restore macOS 15 build matrix and correct test path - Add back macOS 15 configurations for Python 3.9-3.13 - Fix pytest path from test/ to tests/ (correct directory name) The macOS 15 support was accidentally missing from the matrix, and pytest was looking for the wrong directory name. --------- Co-authored-by: Claude <[email protected]>
1 parent 609fa62 commit 18e28bd

File tree

1 file changed

+45
-6
lines changed

1 file changed

+45
-6
lines changed

.github/workflows/build-reusable.yml

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ jobs:
6464
python: '3.12'
6565
- os: macos-14
6666
python: '3.13'
67+
- os: macos-15
68+
python: '3.9'
69+
- os: macos-15
70+
python: '3.10'
71+
- os: macos-15
72+
python: '3.11'
73+
- os: macos-15
74+
python: '3.12'
75+
- os: macos-15
76+
python: '3.13'
6777
- os: macos-13
6878
python: '3.9'
6979
- os: macos-13
@@ -147,7 +157,14 @@ jobs:
147157
# Use system clang for better compatibility
148158
export CC=clang
149159
export CXX=clang++
150-
export MACOSX_DEPLOYMENT_TARGET=11.0
160+
# Homebrew libraries on each macOS version require matching minimum version
161+
if [[ "${{ matrix.os }}" == "macos-13" ]]; then
162+
export MACOSX_DEPLOYMENT_TARGET=13.0
163+
elif [[ "${{ matrix.os }}" == "macos-14" ]]; then
164+
export MACOSX_DEPLOYMENT_TARGET=14.0
165+
elif [[ "${{ matrix.os }}" == "macos-15" ]]; then
166+
export MACOSX_DEPLOYMENT_TARGET=15.0
167+
fi
151168
uv build --wheel --python ${{ matrix.python }} --find-links ${GITHUB_WORKSPACE}/packages/leann-core/dist
152169
else
153170
uv build --wheel --python ${{ matrix.python }} --find-links ${GITHUB_WORKSPACE}/packages/leann-core/dist
@@ -161,7 +178,14 @@ jobs:
161178
export CC=clang
162179
export CXX=clang++
163180
# DiskANN requires macOS 13.3+ for sgesdd_ LAPACK function
164-
export MACOSX_DEPLOYMENT_TARGET=13.3
181+
# But Homebrew libraries on each macOS version require matching minimum version
182+
if [[ "${{ matrix.os }}" == "macos-13" ]]; then
183+
export MACOSX_DEPLOYMENT_TARGET=13.3
184+
elif [[ "${{ matrix.os }}" == "macos-14" ]]; then
185+
export MACOSX_DEPLOYMENT_TARGET=14.0
186+
elif [[ "${{ matrix.os }}" == "macos-15" ]]; then
187+
export MACOSX_DEPLOYMENT_TARGET=15.0
188+
fi
165189
uv build --wheel --python ${{ matrix.python }} --find-links ${GITHUB_WORKSPACE}/packages/leann-core/dist
166190
else
167191
uv build --wheel --python ${{ matrix.python }} --find-links ${GITHUB_WORKSPACE}/packages/leann-core/dist
@@ -197,10 +221,24 @@ jobs:
197221
- name: Repair wheels (macOS)
198222
if: runner.os == 'macOS'
199223
run: |
224+
# Determine deployment target based on runner OS
225+
# Must match the Homebrew libraries for each macOS version
226+
if [[ "${{ matrix.os }}" == "macos-13" ]]; then
227+
HNSW_TARGET="13.0"
228+
DISKANN_TARGET="13.3"
229+
elif [[ "${{ matrix.os }}" == "macos-14" ]]; then
230+
HNSW_TARGET="14.0"
231+
DISKANN_TARGET="14.0"
232+
elif [[ "${{ matrix.os }}" == "macos-15" ]]; then
233+
HNSW_TARGET="15.0"
234+
DISKANN_TARGET="15.0"
235+
fi
236+
200237
# Repair HNSW wheel
201238
cd packages/leann-backend-hnsw
202239
if [ -d dist ]; then
203-
delocate-wheel -w dist_repaired -v dist/*.whl
240+
export MACOSX_DEPLOYMENT_TARGET=$HNSW_TARGET
241+
delocate-wheel -w dist_repaired -v --require-target-macos-version $HNSW_TARGET dist/*.whl
204242
rm -rf dist
205243
mv dist_repaired dist
206244
fi
@@ -209,7 +247,8 @@ jobs:
209247
# Repair DiskANN wheel
210248
cd packages/leann-backend-diskann
211249
if [ -d dist ]; then
212-
delocate-wheel -w dist_repaired -v dist/*.whl
250+
export MACOSX_DEPLOYMENT_TARGET=$DISKANN_TARGET
251+
delocate-wheel -w dist_repaired -v --require-target-macos-version $DISKANN_TARGET dist/*.whl
213252
rm -rf dist
214253
mv dist_repaired dist
215254
fi
@@ -249,8 +288,8 @@ jobs:
249288
# Activate virtual environment
250289
source .venv/bin/activate || source .venv/Scripts/activate
251290
252-
# Run all tests
253-
pytest tests/
291+
# Run tests
292+
pytest -v tests/
254293
255294
- name: Run sanity checks (optional)
256295
run: |

0 commit comments

Comments
 (0)