-
Notifications
You must be signed in to change notification settings - Fork 102
301 lines (262 loc) · 9.33 KB
/
build_cpp.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
name: Build C++
on:
workflow_dispatch:
inputs:
whisper_cpp_repo:
description: 'whisper.cpp repo link'
required: true
default: 'ggerganov/whisper.cpp'
whisper_cpp_repo_ref:
description: 'Tag, branch or commit'
required: true
default: 'v1.5.5'
target_platform:
description: 'Target platforms'
required: true
default: 'windows'
jobs:
build-windows:
name: Build for Windows (x86_64, Vulkan)
if: ${{ contains(fromJson('["windows", "all"]'), github.event.inputs.target_platform) }}
runs-on: windows-latest
steps:
- name: Clone whisper.unity
uses: actions/checkout@v3
with:
path: whisper-unity
- name: Clone whisper.cpp
uses: actions/checkout@v3
with:
repository: ${{ github.event.inputs.whisper_cpp_repo }}
ref: ${{ github.event.inputs.whisper_cpp_repo_ref }}
path: whisper-cpp
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Install Vulkan SDK
uses: jakoch/[email protected]
with:
vulkan_version: 1.3.290.0
optional_components: com.lunarg.vulkan.vma
install_runtime: true
cache: true
stripdown: true
- name: Run build script
run: |
cd whisper-unity
.\build_cpp.bat cpu ..\whisper-cpp\
cd ${{ github.workspace }}\whisper-cpp\build\bin\Release
ren whisper.dll libwhisper.dll
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: windows
path: ${{ github.workspace }}/whisper-cpp/build/bin/Release/libwhisper.dll
if-no-files-found: error
build-windows-cuda:
name: Build for Windows (x86_64, CUDA)
if: ${{ contains(fromJson('["windows_cuda", "all"]'), github.event.inputs.target_platform) }}
runs-on: windows-latest
steps:
- name: Clone whisper.unity
uses: actions/checkout@v3
with:
path: whisper-unity
- name: Clone whisper.cpp
uses: actions/checkout@v3
with:
repository: ${{ github.event.inputs.whisper_cpp_repo }}
ref: ${{ github.event.inputs.whisper_cpp_repo_ref }}
path: whisper-cpp
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Install CUDA Toolkit
id: cuda-toolkit
uses: Jimver/[email protected]
with:
cuda: '12.2.0'
- name: Run build script
run: |
cd whisper-unity
.\build_cpp.bat cuda ..\whisper-cpp\
cd ${{ github.workspace }}\whisper-cpp\build\bin\Release
ren whisper.dll libwhisper_cuda.dll
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: windows-cuda
path: ${{ github.workspace }}/whisper-cpp/build/bin/Release/libwhisper_cuda.dll
if-no-files-found: error
build-linux:
name: Build for Linux (x86_64)
if: ${{ contains(fromJson('["linux", "all"]'), github.event.inputs.target_platform) }}
runs-on: ubuntu-20.04
steps:
- name: Clone whisper.unity
uses: actions/checkout@v3
with:
path: whisper-unity
- name: Clone whisper.cpp
uses: actions/checkout@v3
with:
repository: ${{ github.event.inputs.whisper_cpp_repo }}
ref: ${{ github.event.inputs.whisper_cpp_repo_ref }}
path: whisper-cpp
- name: Run build script
run: |
cd whisper-unity
sh build_cpp_linux.sh ../whisper-cpp/ cpu
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: linux
path: ${{ github.workspace }}/whisper-cpp/build/libwhisper.so
if-no-files-found: error
build-linux-cuda:
name: Build for Linux (x86_64, CUDA)
if: ${{ contains(fromJson('["linux_cuda", "all"]'), github.event.inputs.target_platform) }}
runs-on: ubuntu-20.04
steps:
- name: Clone whisper.unity
uses: actions/checkout@v3
with:
path: whisper-unity
- name: Clone whisper.cpp
uses: actions/checkout@v3
with:
repository: ${{ github.event.inputs.whisper_cpp_repo }}
ref: ${{ github.event.inputs.whisper_cpp_repo_ref }}
path: whisper-cpp
- name: Install CUDA Toolkit
id: cuda-toolkit
uses: Jimver/[email protected]
with:
cuda: '12.2.0'
method: 'network'
- name: Run build script
run: |
cd whisper-unity
sh build_cpp_linux.sh ../whisper-cpp cuda
cd ${{ github.workspace }}/whisper-cpp/build/
mv libwhisper.so libwhisper_cuda.so
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: linux-cuda
path: ${{ github.workspace }}/whisper-cpp/build/libwhisper_cuda.so
if-no-files-found: error
build-macos:
name: Build for MacOS (ARM, x86_64)
if: ${{ contains(fromJson('["macos", "all"]'), github.event.inputs.target_platform) }}
runs-on: macOS-latest
steps:
- name: Clone whisper.unity
uses: actions/checkout@v3
with:
path: whisper-unity
- name: Clone whisper.cpp
uses: actions/checkout@v3
with:
repository: ${{ github.event.inputs.whisper_cpp_repo }}
ref: ${{ github.event.inputs.whisper_cpp_repo_ref }}
path: whisper-cpp
- name: Run build script
run: |
cd whisper-unity
sh build_cpp.sh ../whisper-cpp/ mac
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: macos
path: ${{ github.workspace }}/whisper-cpp/build/libwhisper.dylib
if-no-files-found: error
build-macos-metal:
name: Build for MacOS Metal (ARM, x86_64)
if: ${{ contains(fromJson('["macos_metal", "all"]'), github.event.inputs.target_platform) }}
runs-on: macOS-latest
steps:
- name: Clone whisper.unity
uses: actions/checkout@v3
with:
path: whisper-unity
- name: Clone whisper.cpp
uses: actions/checkout@v3
with:
repository: ${{ github.event.inputs.whisper_cpp_repo }}
ref: ${{ github.event.inputs.whisper_cpp_repo_ref }}
path: whisper-cpp
- name: Run build script
run: |
cd whisper-unity
sh build_cpp.sh ../whisper-cpp/ mac_metal
cd ${{ github.workspace }}/whisper-cpp/build/
mv libwhisper.dylib libwhisper_metal.dylib
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: macos-metal
path: |
${{ github.workspace }}/whisper-cpp/build/libwhisper_metal.dylib
${{ github.workspace }}/whisper-cpp/build/bin/ggml-metal.metal
if-no-files-found: error
build-ios:
name: Build for iOS
if: ${{ contains(fromJson('["ios", "all"]'), github.event.inputs.target_platform) }}
runs-on: macOS-latest
steps:
- name: Clone whisper.unity
uses: actions/checkout@v3
with:
path: whisper-unity
- name: Clone whisper.cpp
uses: actions/checkout@v3
with:
repository: ${{ github.event.inputs.whisper_cpp_repo }}
ref: ${{ github.event.inputs.whisper_cpp_repo_ref }}
path: whisper-cpp
- name: Run build script
run: |
cd whisper-unity
sh build_cpp.sh ../whisper-cpp/ ios
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: ios
path: ${{ github.workspace }}/whisper-cpp/build/libwhisper.a
if-no-files-found: error
build-android:
name: Build for Android (arm64-v8a)
if: ${{ contains(fromJson('["android", "all"]'), github.event.inputs.target_platform) }}
runs-on: ubuntu-latest
steps:
- name: Install Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Install Android NDK
run: |
sdkmanager --install "build-tools;33.0.2"
sdkmanager --install "cmake;3.22.1"
sdkmanager --install "ndk;21.3.6528147"
- name: Clone whisper.unity
uses: actions/checkout@v3
with:
path: whisper-unity
- name: Clone whisper.cpp
uses: actions/checkout@v3
with:
repository: ${{ github.event.inputs.whisper_cpp_repo }}
ref: ${{ github.event.inputs.whisper_cpp_repo_ref }}
path: whisper-cpp
- name: Run build script
run: |
cd whisper-unity
sh build_cpp.sh ../whisper-cpp/ android $ANDROID_HOME/ndk/21.3.6528147/build/cmake/android.toolchain.cmake
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: android
path: ${{ github.workspace }}/whisper-cpp/build/libwhisper.a
if-no-files-found: error