@@ -6,81 +6,60 @@ permissions:
66 contents : write
77
88jobs :
9- define_matrix :
10- name : Define Build Matrix
11- runs-on : ubuntu-latest
12- outputs :
13- matrix : ${{ steps.set-matrix.outputs.matrix }}
14- defaults :
15- run :
16- shell : pwsh
17-
18- steps :
19- - name : Define Job Output
20- id : set-matrix
21- run : |
22- $matrix = @{
23- 'os' = @('macos-11', 'macos-12', 'macos-13')
24- 'pyver' = @('3.10', '3.11', '3.12')
25- }
26-
27- $matrixOut = ConvertTo-Json $matrix -Compress
28- Write-Output ('matrix=' + $matrixOut) >> $env:GITHUB_OUTPUT
29-
309 build_wheels :
31- name : ${{ matrix.os }} Python ${{ matrix.pyver }}
32- needs : define_matrix
10+ name : Build wheels on ${{ matrix.os }}
3311 runs-on : ${{ matrix.os }}
3412 strategy :
35- matrix : ${{ fromJSON(needs.define_matrix.outputs.matrix) }}
36- env :
37- OSVER : ${{ matrix.os }}
13+ matrix :
14+ os : [macos-12, macos-13, macos-14]
3815
3916 steps :
4017 - uses : actions/checkout@v4
4118 with :
4219 submodules : " recursive"
4320
21+ # Used to host cibuildwheel
4422 - uses : actions/setup-python@v5
4523 with :
46- python-version : ${{ matrix.pyver }}
47-
48- - name : Install Dependencies
49- run : |
50- python -m pip install build wheel cmake
24+ python-version : " 3.12"
25+ cache : ' pip'
5126
52- - name : Build Wheel
27+ - name : Install dependencies
5328 run : |
54- XCODE15PATH="/Applications/Xcode_15.0.app/Contents/Developer"
55- XCODE15BINPATH="${XCODE15PATH}/Toolchains/XcodeDefault.xctoolchain/usr/bin"
56- export CMAKE_ARGS="-DLLAMA_NATIVE=off -DLLAMA_METAL=on"
57- [[ "$OSVER" == "macos-13" ]] && export CC="${XCODE15BINPATH}/cc" && export CXX="${XCODE15BINPATH}/c++" && export MACOSX_DEPLOYMENT_TARGET="13.0"
58- [[ "$OSVER" == "macos-12" ]] && export MACOSX_DEPLOYMENT_TARGET="12.0"
59- [[ "$OSVER" == "macos-11" ]] && export MACOSX_DEPLOYMENT_TARGET="11.0"
29+ python -m pip install --upgrade pip
30+ python -m pip install -e .[all]
6031
61- export CMAKE_OSX_ARCHITECTURES="arm64" && export ARCHFLAGS="-arch arm64"
62- VERBOSE=1 python -m build --wheel
63-
64- if [[ "$OSVER" == "macos-13" ]]; then
65- export SDKROOT="${XCODE15PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk"
66- export MACOSX_DEPLOYMENT_TARGET="14.0"
67- VERBOSE=1 python -m build --wheel
68- fi
69-
70- for file in ./dist/*.whl; do cp "$file" "${file/arm64.whl/aarch64.whl}"; done
32+ - name : Build wheels
33+ 34+ env :
35+ # disable repair
36+ CIBW_REPAIR_WHEEL_COMMAND : " "
37+ CIBW_ARCHS : " arm64"
38+ CIBW_ENVIRONMENT : CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_APPLE_SILICON_PROCESSOR=arm64 -DGGML_METAL=on"
39+ CIBW_BUILD : " cp39-* cp310-* cp311-* cp312-*"
40+ with :
41+ package-dir : .
42+ output-dir : wheelhouse2
7143
72- export CMAKE_OSX_ARCHITECTURES="x86_64" && export CMAKE_ARGS="-DLLAMA_NATIVE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_FMA=off -DLLAMA_F16C=off -DLLAMA_METAL=on" && export ARCHFLAGS="-arch x86_64"
73- VERBOSE=1 python -m build --wheel
44+ - uses : actions/upload-artifact@v4
45+ with :
46+ name : wheels-mac_${{ matrix.os }}
47+ path : ./wheelhouse2/*.whl
7448
75- if [[ "$OSVER" == "macos-13" ]]; then
76- export SDKROOT="${XCODE15PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk"
77- export MACOSX_DEPLOYMENT_TARGET="14.0"
78- VERBOSE=1 python -m build --wheel
79- fi
49+ release :
50+ name : Release
51+ needs : [build_wheels]
52+ runs-on : ubuntu-latest
8053
54+ steps :
55+ - uses : actions/download-artifact@v4
56+ with :
57+ merge-multiple : true
58+ path : dist2
59+
8160 - uses : softprops/action-gh-release@v2
8261 with :
83- files : dist /*
62+ files : dist2 /*
8463 # set release name to <tag>-metal
8564 tag_name : ${{ github.ref_name }}-metal
8665 env :
0 commit comments