Skip to content

Build Binaries for OpenWhispr #10

Build Binaries for OpenWhispr

Build Binaries for OpenWhispr #10

name: Build Binaries for OpenWhispr
on:
workflow_dispatch:
inputs:
version_tag:
description: 'Version tag for release (e.g., v1.0.0)'
required: true
type: string
push:
tags:
- 'openwhispr-*'
permissions:
contents: write
env:
CUDA_ARCHITECTURES: "75;80;86;89"
jobs:
build-macos-arm64:
runs-on: macos-14 # M1 runner
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: macos-arm64
- name: Build whisper.cpp
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DWHISPER_METAL=ON \
-DGGML_METAL=ON \
-DBUILD_SHARED_LIBS=OFF
cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
- name: Package binaries
run: |
mkdir -p dist
cp build/bin/whisper-cli dist/whisper-cpp-darwin-arm64
chmod +x dist/whisper-cpp-darwin-arm64
cp build/bin/whisper-server dist/whisper-server-darwin-arm64
chmod +x dist/whisper-server-darwin-arm64
cd dist
zip whisper-cpp-darwin-arm64.zip whisper-cpp-darwin-arm64
zip whisper-server-darwin-arm64.zip whisper-server-darwin-arm64
- name: Upload whisper-cli artifact
uses: actions/upload-artifact@v4
with:
name: whisper-cpp-darwin-arm64
path: dist/whisper-cpp-darwin-arm64.zip
- name: Upload whisper-server artifact
uses: actions/upload-artifact@v4
with:
name: whisper-server-darwin-arm64
path: dist/whisper-server-darwin-arm64.zip
build-macos-x64:
runs-on: macos-14 # Cross-compile for x64 on arm64 runner
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: macos-x64
- name: Build whisper.cpp for x64
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DWHISPER_METAL=OFF \
-DGGML_METAL=OFF \
-DGGML_NATIVE=OFF \
-DBUILD_SHARED_LIBS=OFF
cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
- name: Package binaries
run: |
mkdir -p dist
cp build/bin/whisper-cli dist/whisper-cpp-darwin-x64
chmod +x dist/whisper-cpp-darwin-x64
cp build/bin/whisper-server dist/whisper-server-darwin-x64
chmod +x dist/whisper-server-darwin-x64
cd dist
zip whisper-cpp-darwin-x64.zip whisper-cpp-darwin-x64
zip whisper-server-darwin-x64.zip whisper-server-darwin-x64
- name: Upload whisper-cli artifact
uses: actions/upload-artifact@v4
with:
name: whisper-cpp-darwin-x64
path: dist/whisper-cpp-darwin-x64.zip
- name: Upload whisper-server artifact
uses: actions/upload-artifact@v4
with:
name: whisper-server-darwin-x64
path: dist/whisper-server-darwin-x64.zip
build-windows-x64-cpu:
runs-on: windows-2022
steps:
- name: Free up disk space
shell: pwsh
run: |
# Remove unnecessary tools to free up disk space
Remove-Item -Recurse -Force "C:\hostedtoolcache\CodeQL" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "C:\hostedtoolcache\Java*" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "C:\hostedtoolcache\go" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "C:\hostedtoolcache\Python" -ErrorAction SilentlyContinue
- name: Checkout
uses: actions/checkout@v4
- name: Install Ninja
run: choco install ninja -y
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: windows-x64-cpu
variant: sccache
- name: Build whisper.cpp (CPU-only)
shell: cmd
run: |
cmake -S . -B build -G "Ninja Multi-Config" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_C_COMPILER_LAUNCHER=sccache ^
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache ^
-DBUILD_SHARED_LIBS=OFF ^
-DGGML_NATIVE=OFF ^
-DGGML_CUDA=OFF ^
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
cmake --build build --config Release -j %NUMBER_OF_PROCESSORS%
- name: Package binaries
shell: pwsh
run: |
mkdir dist
Copy-Item build\bin\Release\whisper-cli.exe dist\whisper-cpp-win32-x64-cpu.exe
Copy-Item build\bin\Release\whisper-server.exe dist\whisper-server-win32-x64-cpu.exe
Set-Location dist
Compress-Archive -Path whisper-cpp-win32-x64-cpu.exe -DestinationPath whisper-cpp-win32-x64-cpu.zip
Compress-Archive -Path whisper-server-win32-x64-cpu.exe -DestinationPath whisper-server-win32-x64-cpu.zip
- name: Upload whisper-cli artifact
uses: actions/upload-artifact@v4
with:
name: whisper-cpp-win32-x64-cpu
path: dist/whisper-cpp-win32-x64-cpu.zip
- name: Upload whisper-server artifact
uses: actions/upload-artifact@v4
with:
name: whisper-server-win32-x64-cpu
path: dist/whisper-server-win32-x64-cpu.zip
build-windows-x64-cuda:
runs-on: windows-2022
steps:
- name: Free up disk space
shell: pwsh
run: |
# Remove unnecessary tools to free up disk space
Remove-Item -Recurse -Force "C:\hostedtoolcache\CodeQL" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "C:\hostedtoolcache\Java*" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "C:\hostedtoolcache\go" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "C:\hostedtoolcache\Python" -ErrorAction SilentlyContinue
- name: Checkout
uses: actions/checkout@v4
- name: Install Ninja
run: choco install ninja -y
- name: Install CUDA Toolkit 12.4.0
run: |
$CUDA_VERSION = "12.4.0"
$CUDA_TOOLKIT_DIR = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$CUDA_VERSION"
$CUDA_DOWNLOAD = "https://developer.download.nvidia.com/compute/cuda/redist"
# Component versions for CUDA 12.4.0
$CUDART_VER = "12.4.127"
$NVCC_VER = "12.4.131"
$NVRTC_VER = "12.4.127"
$CUBLAS_VER = "12.4.5.8"
$NVTX_VER = "12.4.127"
$PROFILER_VER = "12.4.127"
$VS_VER = "12.4.127"
$CCCL_VER = "12.4.127"
# Create CUDA toolkit directory
New-Item -ItemType Directory -Force -Path $CUDA_TOOLKIT_DIR
# Install unzip
choco install unzip -y
# Download CUDA components from official NVIDIA CDN
curl -O "$CUDA_DOWNLOAD/cuda_cudart/windows-x86_64/cuda_cudart-windows-x86_64-${CUDART_VER}-archive.zip"
curl -O "$CUDA_DOWNLOAD/cuda_nvcc/windows-x86_64/cuda_nvcc-windows-x86_64-${NVCC_VER}-archive.zip"
curl -O "$CUDA_DOWNLOAD/cuda_nvrtc/windows-x86_64/cuda_nvrtc-windows-x86_64-${NVRTC_VER}-archive.zip"
curl -O "$CUDA_DOWNLOAD/libcublas/windows-x86_64/libcublas-windows-x86_64-${CUBLAS_VER}-archive.zip"
curl -O "$CUDA_DOWNLOAD/cuda_nvtx/windows-x86_64/cuda_nvtx-windows-x86_64-${NVTX_VER}-archive.zip"
curl -O "$CUDA_DOWNLOAD/cuda_profiler_api/windows-x86_64/cuda_profiler_api-windows-x86_64-${PROFILER_VER}-archive.zip"
curl -O "$CUDA_DOWNLOAD/visual_studio_integration/windows-x86_64/visual_studio_integration-windows-x86_64-${VS_VER}-archive.zip"
curl -O "$CUDA_DOWNLOAD/cuda_cccl/windows-x86_64/cuda_cccl-windows-x86_64-${CCCL_VER}-archive.zip"
# Extract all components
unzip -q '*.zip' -d $CUDA_TOOLKIT_DIR
# Copy extracted files to CUDA toolkit directory
xcopy "$CUDA_TOOLKIT_DIR\cuda_cudart-windows-x86_64-${CUDART_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
xcopy "$CUDA_TOOLKIT_DIR\cuda_nvcc-windows-x86_64-${NVCC_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
xcopy "$CUDA_TOOLKIT_DIR\cuda_nvrtc-windows-x86_64-${NVRTC_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
xcopy "$CUDA_TOOLKIT_DIR\libcublas-windows-x86_64-${CUBLAS_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
xcopy "$CUDA_TOOLKIT_DIR\cuda_nvtx-windows-x86_64-${NVTX_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
xcopy "$CUDA_TOOLKIT_DIR\cuda_profiler_api-windows-x86_64-${PROFILER_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
xcopy "$CUDA_TOOLKIT_DIR\cuda_cccl-windows-x86_64-${CCCL_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
xcopy "$CUDA_TOOLKIT_DIR\visual_studio_integration-windows-x86_64-${VS_VER}-archive\visual_studio_integration\MSBuildExtensions\*" "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\BuildCustomizations" /E /I /H /Y
# Set environment variables
echo "$CUDA_TOOLKIT_DIR\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "CUDA_PATH=$CUDA_TOOLKIT_DIR" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Verify CUDA installation
run: nvcc --version
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: windows-x64-cuda
variant: sccache
- name: Build whisper.cpp with CUDA
shell: cmd
run: |
cmake -S . -B build -G "Ninja Multi-Config" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_C_COMPILER_LAUNCHER=sccache ^
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache ^
-DBUILD_SHARED_LIBS=OFF ^
-DGGML_NATIVE=OFF ^
-DGGML_CUDA=ON ^
-DCMAKE_CUDA_ARCHITECTURES="${{ env.CUDA_ARCHITECTURES }}" ^
-DCMAKE_CUDA_FLAGS="--use-local-env" ^
-DCMAKE_CUDA_HOST_COMPILER="cl.exe" ^
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
cmake --build build --config Release -j %NUMBER_OF_PROCESSORS%
- name: Package binaries with CUDA DLLs
shell: pwsh
run: |
$CUDA_PATH = $env:CUDA_PATH
mkdir dist
# Copy main binaries
Copy-Item build\bin\Release\whisper-cli.exe dist\whisper-cpp-win32-x64-cuda.exe
Copy-Item build\bin\Release\whisper-server.exe dist\whisper-server-win32-x64-cuda.exe
# Required CUDA runtime DLLs for GPU acceleration
$cudaDlls = @("cudart64_12.dll", "cublas64_12.dll", "cublasLt64_12.dll")
$bundledDlls = @()
foreach ($dll in $cudaDlls) {
$dllPath = Join-Path $CUDA_PATH "bin\$dll"
if (Test-Path $dllPath) {
Write-Host "Bundling $dll"
Copy-Item $dllPath dist\
$bundledDlls += $dll
} else {
Write-Host "Warning: $dll not found at $dllPath"
}
}
Write-Host "Contents of dist folder:"
Get-ChildItem dist | Format-Table Name, Length
# Fail if no CUDA DLLs were bundled
if ($bundledDlls.Count -eq 0) {
Write-Error "No CUDA DLLs were bundled. Build failed."
exit 1
}
# Create zip archives with dynamically built file lists
Set-Location dist
$cliFiles = @("whisper-cpp-win32-x64-cuda.exe") + $bundledDlls
$serverFiles = @("whisper-server-win32-x64-cuda.exe") + $bundledDlls
Compress-Archive -Path $cliFiles -DestinationPath whisper-cpp-win32-x64-cuda.zip
Compress-Archive -Path $serverFiles -DestinationPath whisper-server-win32-x64-cuda.zip
- name: Upload whisper-cli artifact
uses: actions/upload-artifact@v4
with:
name: whisper-cpp-win32-x64-cuda
path: dist/whisper-cpp-win32-x64-cuda.zip
- name: Upload whisper-server artifact
uses: actions/upload-artifact@v4
with:
name: whisper-server-win32-x64-cuda
path: dist/whisper-server-win32-x64-cuda.zip
build-linux-x64-cpu:
runs-on: ubuntu-22.04
steps:
- name: Free up disk space
run: |
# Remove unnecessary tools to free up disk space for builds
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
df -h
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: linux-x64-cpu
- name: Build whisper.cpp (CPU-only)
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_SHARED_LIBS=OFF \
-DGGML_NATIVE=OFF \
-DGGML_CUDA=OFF
cmake --build build --config Release -j $(nproc)
- name: Package binaries
run: |
mkdir -p dist
cp build/bin/whisper-cli dist/whisper-cpp-linux-x64-cpu
chmod +x dist/whisper-cpp-linux-x64-cpu
cp build/bin/whisper-server dist/whisper-server-linux-x64-cpu
chmod +x dist/whisper-server-linux-x64-cpu
cd dist
zip whisper-cpp-linux-x64-cpu.zip whisper-cpp-linux-x64-cpu
zip whisper-server-linux-x64-cpu.zip whisper-server-linux-x64-cpu
- name: Upload whisper-cli artifact
uses: actions/upload-artifact@v4
with:
name: whisper-cpp-linux-x64-cpu
path: dist/whisper-cpp-linux-x64-cpu.zip
- name: Upload whisper-server artifact
uses: actions/upload-artifact@v4
with:
name: whisper-server-linux-x64-cpu
path: dist/whisper-server-linux-x64-cpu.zip
build-linux-x64-cuda:
runs-on: ubuntu-22.04
steps:
- name: Free up disk space
run: |
# Remove unnecessary tools to free up disk space for CUDA build
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
df -h
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake wget
- name: Install CUDA Toolkit 12.4
run: |
# Download and install CUDA keyring
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
# Install minimal CUDA toolkit (compiler and libraries only, no driver)
sudo apt-get install -y cuda-toolkit-12-4
# Set environment variables
echo "/usr/local/cuda-12.4/bin" >> $GITHUB_PATH
echo "CUDA_PATH=/usr/local/cuda-12.4" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Verify CUDA installation
run: |
export PATH=/usr/local/cuda-12.4/bin:$PATH
nvcc --version
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: linux-x64-cuda
- name: Build whisper.cpp with CUDA
run: |
export PATH=/usr/local/cuda-12.4/bin:$PATH
export CUDA_PATH=/usr/local/cuda-12.4
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_SHARED_LIBS=OFF \
-DGGML_NATIVE=OFF \
-DGGML_CUDA=ON \
-DCMAKE_CUDA_COMPILER=/usr/local/cuda-12.4/bin/nvcc \
-DCMAKE_CUDA_ARCHITECTURES="${{ env.CUDA_ARCHITECTURES }}"
cmake --build build --config Release -j $(nproc)
- name: Package binaries
run: |
mkdir -p dist
cp build/bin/whisper-cli dist/whisper-cpp-linux-x64-cuda
chmod +x dist/whisper-cpp-linux-x64-cuda
cp build/bin/whisper-server dist/whisper-server-linux-x64-cuda
chmod +x dist/whisper-server-linux-x64-cuda
cd dist
zip whisper-cpp-linux-x64-cuda.zip whisper-cpp-linux-x64-cuda
zip whisper-server-linux-x64-cuda.zip whisper-server-linux-x64-cuda
- name: Upload whisper-cli artifact
uses: actions/upload-artifact@v4
with:
name: whisper-cpp-linux-x64-cuda
path: dist/whisper-cpp-linux-x64-cuda.zip
- name: Upload whisper-server artifact
uses: actions/upload-artifact@v4
with:
name: whisper-server-linux-x64-cuda
path: dist/whisper-server-linux-x64-cuda.zip
create-release:
needs: [build-macos-arm64, build-macos-x64, build-windows-x64-cpu, build-windows-x64-cuda, build-linux-x64-cpu, build-linux-x64-cuda]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release files
run: |
mkdir release
mv artifacts/whisper-cpp-darwin-arm64/whisper-cpp-darwin-arm64.zip release/
mv artifacts/whisper-cpp-darwin-x64/whisper-cpp-darwin-x64.zip release/
mv artifacts/whisper-cpp-win32-x64-cpu/whisper-cpp-win32-x64-cpu.zip release/
mv artifacts/whisper-cpp-win32-x64-cuda/whisper-cpp-win32-x64-cuda.zip release/
mv artifacts/whisper-cpp-linux-x64-cpu/whisper-cpp-linux-x64-cpu.zip release/
mv artifacts/whisper-cpp-linux-x64-cuda/whisper-cpp-linux-x64-cuda.zip release/
mv artifacts/whisper-server-darwin-arm64/whisper-server-darwin-arm64.zip release/
mv artifacts/whisper-server-darwin-x64/whisper-server-darwin-x64.zip release/
mv artifacts/whisper-server-win32-x64-cpu/whisper-server-win32-x64-cpu.zip release/
mv artifacts/whisper-server-win32-x64-cuda/whisper-server-win32-x64-cuda.zip release/
mv artifacts/whisper-server-linux-x64-cpu/whisper-server-linux-x64-cpu.zip release/
mv artifacts/whisper-server-linux-x64-cuda/whisper-server-linux-x64-cuda.zip release/
ls -la release/
- name: Determine version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ github.event.inputs.version_tag }}" >> $GITHUB_OUTPUT
else
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.version }}
name: OpenWhispr Binaries ${{ steps.version.outputs.version }}
body: |
Pre-built whisper.cpp binaries for OpenWhispr. CPU and CUDA variants are included.
## GPU Acceleration
- **macOS ARM64**: Metal GPU acceleration (M1/M2/M3/M4)
- **Windows x64**: NVIDIA CUDA build (bundled DLLs) and CPU build
- **Linux x64**: NVIDIA CUDA build (requires system CUDA) and CPU build
- **macOS x64**: CPU only (Intel Macs)
## whisper-cli binaries
- `whisper-cpp-darwin-arm64.zip` - macOS Apple Silicon with Metal
- `whisper-cpp-darwin-x64.zip` - macOS Intel (CPU only)
- `whisper-cpp-win32-x64-cpu.zip` - Windows x64 CPU-only
- `whisper-cpp-win32-x64-cuda.zip` - Windows x64 with CUDA (includes bundled CUDA DLLs)
- `whisper-cpp-linux-x64-cpu.zip` - Linux x64 CPU-only
- `whisper-cpp-linux-x64-cuda.zip` - Linux x64 with CUDA
## whisper-server binaries
- `whisper-server-darwin-arm64.zip` - macOS Apple Silicon with Metal
- `whisper-server-darwin-x64.zip` - macOS Intel (CPU only)
- `whisper-server-win32-x64-cpu.zip` - Windows x64 CPU-only
- `whisper-server-win32-x64-cuda.zip` - Windows x64 with CUDA (includes bundled CUDA DLLs)
- `whisper-server-linux-x64-cpu.zip` - Linux x64 CPU-only
- `whisper-server-linux-x64-cuda.zip` - Linux x64 with CUDA
## Requirements
- **Windows CUDA build**: No additional requirements - CUDA DLLs are bundled.
- **Windows CPU build**: No requirements.
- **Linux CUDA build**: Install latest NVIDIA drivers and CUDA toolkit for GPU acceleration.
- **Linux CPU build**: No requirements.
- **All other platforms**: No requirements.
## Supported NVIDIA GPUs
Compute capabilities 7.5+ (RTX 2000 series through RTX 40 series)
files: release/*
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}