Merge pull request #11 from royshil/update-windows-vulkan-1.4.328.1 #158
This file contains hidden or 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" | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| tags: | |
| - "*" | |
| pull_request: | |
| branches: | |
| - "main" | |
| concurrency: | |
| group: "${{ github.workflow }}-${{ github.ref }}" | |
| cancel-in-progress: "${{ github.ref != 'refs/heads/main' }}" | |
| jobs: | |
| BuildMac: | |
| runs-on: "macos-14" | |
| strategy: | |
| matrix: | |
| config: | |
| - "Release" | |
| architecture: [x86_64, arm64] | |
| coreml: [on, off] | |
| metal-std: [embedded, 2.4, "3.0", 3.1, 3.2] | |
| # See support.apple.com/en-gb/102894 for compatibility info | |
| exclude: | |
| - architecture: arm64 | |
| coreml: off | |
| - metal-std: "3.0" | |
| coreml: off | |
| - metal-std: 3.1 | |
| coreml: off | |
| - metal-std: 3.2 | |
| coreml: off | |
| defaults: | |
| run: | |
| shell: "bash" | |
| steps: | |
| - name: "Get version" | |
| run: | | |
| if [[ $GITHUB_REF =~ ^refs/tags/ ]] | |
| then version="${GITHUB_REF#refs/tags/}" | |
| else version=main | |
| fi | |
| printf "version=%s" "$version" > "$GITHUB_OUTPUT" | |
| id: "get-version" | |
| - uses: maxim-lobanov/[email protected] | |
| id: set-xcode-version | |
| with: | |
| xcode-version: 16.2 | |
| - name: ccache | |
| uses: hendrikmuhs/[email protected] | |
| with: | |
| key: ${{ github.job }}-MacOS-${{ matrix.architecture }} | |
| - name: "Install x86_64 homebrew" | |
| if: ${{ matrix.architecture == 'x86_64' }} | |
| run: | | |
| arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| - name: "Checkout" | |
| uses: "actions/checkout@v4" | |
| - name: "Run build-macos.sh" | |
| run: "./build-macos.sh ${{ steps.get-version.outputs.version }}" | |
| env: | |
| MACOS_ARCH: ${{ matrix.architecture }} | |
| METAL_STD: ${{ matrix.metal-std }} | |
| USE_COREML: ${{ matrix.coreml }} | |
| - name: "Upload artifact" | |
| uses: "actions/upload-artifact@v4" | |
| with: | |
| name: ${{ matrix.coreml == 'on' && format('whispercpp-macos-{0}-metal{1}', matrix.architecture, matrix.metal-std) || format('whispercpp-macos-{0}-metal{1}-no-coreml', matrix.architecture, matrix.metal-std) }} | |
| path: "*.tar.gz" | |
| BuildLinux: | |
| runs-on: "ubuntu-22.04" | |
| strategy: | |
| matrix: | |
| config: | |
| - "Release" | |
| accel: [generic, nvidia, amd] | |
| defaults: | |
| run: | |
| shell: "bash" | |
| steps: | |
| - name: "Get version" | |
| run: | | |
| if [[ $GITHUB_REF =~ ^refs/tags/ ]] | |
| then version="${GITHUB_REF#refs/tags/}" | |
| else version=main | |
| fi | |
| printf "version=%s" "$version" > "$GITHUB_OUTPUT" | |
| id: "get-version" | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| # this might remove tools that are actually needed, | |
| # if set to "true" but frees about 6 GB | |
| tool-cache: false | |
| # Needed to prevent running out of memory | |
| swap-storage: false | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: true | |
| - name: "Checkout" | |
| uses: "actions/checkout@v4" | |
| - name: "Install OpenBLAS and OpenCL" | |
| run: | | |
| sudo apt update | |
| sudo apt install libopenblas-dev libopenblas-openmp-dev nvidia-opencl-dev ocl-icd-opencl-dev opencl-headers | |
| - name: "Install Vulkan SDK" | |
| run: | | |
| sudo apt install -y wget | |
| wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc | |
| sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list http://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list | |
| sudo apt update | |
| sudo apt install vulkan-sdk | |
| # - name: "Install oneAPI (SYCL) toolkit" | |
| # run: | | |
| # # download the key to system keyring | |
| # wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ | |
| # | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null | |
| # # add signed entry to apt sources and configure the APT client to use Intel repository: | |
| # echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/ | |
| # oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list | |
| # sudo apt update | |
| # sudo apt install intel-basekit | |
| # # Probably don't need these | |
| # # sudo apt install intel-hpckit intel-renderkit | |
| - name: "Install CUDA toolkit" | |
| if: ${{ matrix.accel == 'nvidia' }} | |
| run: | | |
| 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 update | |
| sudo apt -y install cuda-toolkit-12-8 | |
| export PATH=/usr/local/cuda-12.8/bin${PATH:+:${PATH}} | |
| export LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} | |
| - name: "Install AMD hip SDK v6.4.2" | |
| if: ${{ matrix.accel == 'amd' }} | |
| run: | | |
| wget https://repo.radeon.com/amdgpu-install/6.4.2/ubuntu/jammy/amdgpu-install_6.4.60402-1_all.deb | |
| sudo apt install ./amdgpu-install_6.4.60402-1_all.deb | |
| sudo apt update | |
| sudo apt install python3-setuptools python3-wheel | |
| sudo usermod -a -G render,video $LOGNAME # Add the current user to the render and video groups | |
| sudo apt install rocm | |
| sudo apt update && sudo apt install hipblas | |
| - name: "Run build-linux.sh" | |
| run: "chmod +x build-linux.sh && ./build-linux.sh ${{ matrix.config }} ${{ steps.get-version.outputs.version }}" | |
| env: | |
| BUILD_WITH_ACCEL: ${{ matrix.accel }} | |
| LINUX_ARCH: "x86_64" | |
| - uses: "actions/upload-artifact@v4" | |
| with: | |
| name: "whispercpp-linux-${{ matrix.config }}-${{ matrix.accel }}" | |
| path: "*.tar.gz" | |
| BuildWindows: | |
| runs-on: "windows-2022" | |
| strategy: | |
| matrix: | |
| config: | |
| - "Release" | |
| accel: [generic, nvidia, amd] | |
| steps: | |
| - name: "Get version" | |
| shell: bash | |
| run: | | |
| if [[ $GITHUB_REF =~ ^refs/tags/ ]] | |
| then version="${GITHUB_REF#refs/tags/}" | |
| else version=main | |
| fi | |
| printf "version=%s" "$version" > "$GITHUB_OUTPUT" | |
| id: "get-version" | |
| - name: "Checkout" | |
| uses: "actions/checkout@v4" | |
| - name: ccache | |
| uses: hendrikmuhs/[email protected] | |
| with: | |
| key: ${{ github.job }}-Windows-${{ matrix.accel }} | |
| # - name: Install CUDA Toolkit | |
| # if: ${{ matrix.accel == 'cuda' }} | |
| # id: cuda-toolkit | |
| # uses: Jimver/[email protected] | |
| # with: | |
| # cuda: '12.5.1' | |
| # sub-packages: '["cudart", "nvcc", "cublas", "cublas_dev", "visual_studio_integration"]' | |
| # method: 'network' | |
| - name: Setup CUDA Toolkit | |
| if: ${{ matrix.accel == 'nvidia' }} | |
| id: cuda-toolkit | |
| shell: pwsh | |
| run: ./setup_cuda.ps1 | |
| env: | |
| INPUT_CUDA_VERSION: '12.8.1' | |
| - name: Set CUDA_TOOLKIT_ROOT_DIR if CUDA is installed | |
| if: ${{ matrix.accel == 'nvidia' }} | |
| run: | | |
| "CUDA_TOOLKIT_ROOT_DIR=$env:CUDA_PATH" >> $env:GITHUB_ENV | |
| - name: Install AMD hip SDK v6.4.2 | |
| id: depends-hipblas | |
| if: ${{ matrix.accel == 'amd' }} | |
| run: | | |
| $ErrorActionPreference = "Stop" | |
| write-host "Downloading AMD HIP SDK Installer" | |
| Invoke-WebRequest -Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-25.Q3-Win10-Win11-For-HIP.exe" -OutFile "${env:RUNNER_TEMP}\rocm-install.exe" | |
| write-host "Installing AMD HIP SDK" | |
| Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait | |
| write-host "Completed AMD HIP SDK installation" | |
| - name: Verify ROCm | |
| id: verify-hipblas | |
| if: ${{ matrix.accel == 'amd' }} | |
| run: | | |
| & 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version | |
| - name: Prepare hipBLAS environment | |
| id: prepare-hipblas | |
| if: ${{ matrix.accel == 'amd' }} | |
| run: | | |
| "HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)" >> $env:GITHUB_ENV | |
| - name: "Install Vulkan SDK (1.4.328.1)" | |
| run: | | |
| $ErrorActionPreference = "Stop" | |
| $SDKVersion = "1.4.328.1" | |
| $SDKFileName = "vulkansdk-windows-X64-${SDKVersion}.exe" | |
| write-host "Downloading Vulkan SDK" | |
| Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.4.328.1/windows/$SDKFileName" -OutFile "${env:RUNNER_TEMP}\$SDKFileName" | |
| write-host "Installing Vulkan SDK" | |
| Start-Process "${env:RUNNER_TEMP}\$SDKFileName" -ArgumentList '--accept-licenses --default-answer --confirm-command install' -NoNewWindow -Wait | |
| write-host "Completed Vulkan SDK installation" | |
| - name: "Run Build-Windows.ps1" | |
| run: "./Build-Windows.ps1 -Version ${{ steps.get-version.outputs.version }}" | |
| env: | |
| BUILD_WITH_ACCEL: ${{ matrix.accel }} | |
| - uses: "actions/upload-artifact@v4" | |
| with: | |
| name: "whispercpp-windows-${{ matrix.accel }}" | |
| path: "*.zip" | |
| Release: | |
| runs-on: "ubuntu-22.04" | |
| if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
| needs: | |
| - "BuildMac" | |
| - "BuildLinux" | |
| - "BuildWindows" | |
| permissions: | |
| contents: "write" | |
| defaults: | |
| run: | |
| shell: "bash" | |
| steps: | |
| - name: "Get version" | |
| run: | | |
| if [[ $GITHUB_REF =~ ^refs/tags/ ]] | |
| then version="${GITHUB_REF#refs/tags/}" | |
| else version=main | |
| fi | |
| printf "version=%s" "$version" > "$GITHUB_OUTPUT" | |
| id: "get-version" | |
| - name: "Download build artifacts" | |
| uses: "actions/download-artifact@v4" | |
| - name: "Create Release" | |
| uses: "softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5" | |
| with: | |
| draft: true | |
| tag_name: "${{ steps.get-version.outputs.version }}" | |
| name: "${{ steps.get-version.outputs.version }}" | |
| files: | | |
| ${{ github.workspace }}/**/*.tar.gz | |
| ${{ github.workspace }}/**/*.zip |