Build C++ #84
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/install-vulkan-sdk-action@v1.0.4 | |
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/cuda-toolkit@v0.2.11 | |
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/cuda-toolkit@v0.2.11 | |
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 |