Skip to content

Commit e92faab

Browse files
Vaibhavs10Narsilggerganov
authored andcommitted
build : add mac pre-build binaries (ggml-org#6182)
* Initial commit - add mac prebuilds. * forward contribution credits for building the workflow. * minor : remove trailing whitespaces --------- Co-authored-by: Nicolas Patry <[email protected]> Co-authored-by: Georgi Gerganov <[email protected]>
1 parent c45411c commit e92faab

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed

.github/workflows/build.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,118 @@ env:
2121
GGML_N_THREADS: 1
2222

2323
jobs:
24+
macOS-latest-cmake-arm64:
25+
runs-on: macos-14
26+
27+
steps:
28+
- name: Clone
29+
id: checkout
30+
uses: actions/checkout@v3
31+
32+
- name: Dependencies
33+
id: depends
34+
continue-on-error: true
35+
run: |
36+
brew update
37+
38+
- name: Build
39+
id: cmake_build
40+
run: |
41+
sysctl -a
42+
mkdir build
43+
cd build
44+
cmake -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_METAL_EMBED_LIBRARY=ON ..
45+
cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
46+
47+
- name: Test
48+
id: cmake_test
49+
run: |
50+
cd build
51+
ctest -L main --verbose --timeout 900
52+
53+
- name: Determine tag name
54+
id: tag
55+
shell: bash
56+
run: |
57+
BUILD_NUMBER="$(git rev-list --count HEAD)"
58+
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
59+
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
60+
echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
61+
else
62+
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
63+
echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
64+
fi
65+
66+
- name: Pack artifacts
67+
id: pack_artifacts
68+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
69+
run: |
70+
cp LICENSE ./build/bin/
71+
zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip ./build/bin/*
72+
73+
- name: Upload artifacts
74+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
75+
uses: actions/upload-artifact@v3
76+
with:
77+
path: |
78+
llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip
79+
80+
macOS-latest-cmake-x64:
81+
runs-on: macos-latest
82+
83+
steps:
84+
- name: Clone
85+
id: checkout
86+
uses: actions/checkout@v3
87+
88+
- name: Dependencies
89+
id: depends
90+
continue-on-error: true
91+
run: |
92+
brew update
93+
94+
- name: Build
95+
id: cmake_build
96+
run: |
97+
sysctl -a
98+
mkdir build
99+
cd build
100+
cmake -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_METAL_EMBED_LIBRARY=ON ..
101+
cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
102+
103+
- name: Test
104+
id: cmake_test
105+
run: |
106+
cd build
107+
ctest -L main --verbose --timeout 900
108+
109+
- name: Determine tag name
110+
id: tag
111+
shell: bash
112+
run: |
113+
BUILD_NUMBER="$(git rev-list --count HEAD)"
114+
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
115+
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
116+
echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
117+
else
118+
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
119+
echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
120+
fi
121+
122+
- name: Pack artifacts
123+
id: pack_artifacts
124+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
125+
run: |
126+
cp LICENSE ./build/bin/
127+
zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip ./build/bin/*
128+
129+
- name: Upload artifacts
130+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
131+
uses: actions/upload-artifact@v3
132+
with:
133+
path: |
134+
llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip
135+
24136
ubuntu-focal-make:
25137
runs-on: ubuntu-20.04
26138

@@ -748,6 +860,8 @@ jobs:
748860
- macOS-latest-cmake
749861
- windows-latest-cmake
750862
- windows-latest-cmake-cublas
863+
- macOS-latest-cmake-arm64
864+
- macOS-latest-cmake-x64
751865

752866
steps:
753867
- name: Clone

0 commit comments

Comments
 (0)