@@ -6,79 +6,63 @@ permissions:
6
6
contents : write
7
7
8
8
jobs :
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-12', 'macos-13', 'macos-14')
24
- 'pyver' = @('3.9', '3.10', '3.11', '3.12')
25
- }
26
-
27
- $matrixOut = ConvertTo-Json $matrix -Compress
28
- Write-Output ('matrix=' + $matrixOut) >> $env:GITHUB_OUTPUT
29
-
30
9
build_wheels :
31
- name : ${{ matrix.os }} Python ${{ matrix.pyver }}
32
- needs : define_matrix
10
+ name : Build wheels on ${{ matrix.os }}
33
11
runs-on : ${{ matrix.os }}
34
12
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]
38
15
39
16
steps :
40
17
- uses : actions/checkout@v4
41
18
with :
42
19
submodules : " recursive"
43
20
21
+ # Used to host cibuildwheel
44
22
- uses : actions/setup-python@v5
45
23
with :
46
- python-version : ${{ matrix.pyver }}
24
+ python-version : " 3.12 "
47
25
cache : ' pip'
48
26
49
- - name : Install Dependencies
27
+ - name : Install dependencies
50
28
run : |
51
- python -m pip install build wheel cmake
29
+ python -m pip install --upgrade pip
30
+ python -m pip install -e .[all]
52
31
53
- - name : Build Wheel
54
- run : |
55
- XCODE15PATH="/Applications/Xcode_15.0.app/Contents/Developer"
56
- XCODE15BINPATH="${XCODE15PATH}/Toolchains/XcodeDefault.xctoolchain/usr/bin"
57
- export CMAKE_ARGS="-DLLAMA_NATIVE=off -DLLAMA_METAL=on"
58
- [[ "$OSVER" == "macos-13" ]] && export CC="${XCODE15BINPATH}/cc" && export CXX="${XCODE15BINPATH}/c++" && export MACOSX_DEPLOYMENT_TARGET="13.0"
59
- [[ "$OSVER" == "macos-12" ]] && export MACOSX_DEPLOYMENT_TARGET="12.0"
60
- # [[ "$OSVER" == "macos-11" ]] && export MACOSX_DEPLOYMENT_TARGET="11.0"
61
-
62
- export CMAKE_OSX_ARCHITECTURES="arm64" && export ARCHFLAGS="-arch arm64"
63
- VERBOSE=1 python -m build --wheel
64
-
65
- if [[ "$OSVER" == "macos-13" ]]; then
66
- export SDKROOT="${XCODE15PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk"
67
- export MACOSX_DEPLOYMENT_TARGET="14.0"
68
- VERBOSE=1 python -m build --wheel
69
- fi
32
+ - name : Build wheels
33
+ uses : pypa/cibuildwheel@v2.17.0
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 -DLLAMA_METAL=on"
39
+ CIBW_BUILD : " cp39-* cp310-* cp311-* cp312-* pp39-* pp310-*"
40
+ with :
41
+ package-dir : .
42
+ output-dir : wheelhouse
70
43
71
- for file in ./dist/*.whl; do cp "$file" "${file/arm64.whl/aarch64.whl}"; done
44
+ - uses : actions/upload-artifact@v4
45
+ with :
46
+ name : wheels-mac_${{ matrix.os }}
47
+ path : ./wheelhouse/*.whl
72
48
73
- # 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"
74
- # VERBOSE=1 python -m build --wheel
49
+ release :
50
+ name : Release
51
+ needs : [build_wheels]
52
+ runs-on : ubuntu-latest
75
53
76
- # if [[ "$OSVER" == "macos-13" ]]; then
77
- # export SDKROOT="${XCODE15PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk"
78
- # export MACOSX_DEPLOYMENT_TARGET="14.0"
79
- # VERBOSE=1 python -m build --wheel
80
- # fi
54
+ steps :
55
+ - uses : actions/download-artifact@v4
56
+ with :
57
+ merge-multiple : true
58
+ path : dist
81
59
60
+ - uses : softprops/action-gh-release@v2
61
+ with :
62
+ files : dist/*
63
+ env :
64
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
65
+
82
66
- uses : softprops/action-gh-release@v2
83
67
with :
84
68
files : dist/*
0 commit comments