Build Wheels (Vulkan) #2
Workflow file for this run
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 Wheels (Vulkan) | |
| on: workflow_dispatch | |
| permissions: | |
| contents: write | |
| env: | |
| VULKAN_SDK_VERSION: "1.4.341.0" | |
| VULKAN_SDK_LINUX_SHA256: "ed66477d587a5587dc3601b1c2cdcc1fab5529c505f53a00171876cecd9b4fbe" | |
| jobs: | |
| build_wheels: | |
| name: Build Vulkan wheel on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-22.04 | |
| pyver: "3.9" | |
| artifact: wheels-vulkan-ubuntu-22.04 | |
| - os: windows-2022 | |
| pyver: "3.9" | |
| artifact: wheels-vulkan-windows-2022 | |
| steps: | |
| - name: Set up MSVC | |
| if: runner.os == 'Windows' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: x64 | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: "recursive" | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.pyver }} | |
| cache: "pip" | |
| - name: Install Vulkan SDK | |
| if: runner.os == 'Linux' | |
| run: | | |
| curl -fL \ | |
| "https://sdk.lunarg.com/sdk/download/${VULKAN_SDK_VERSION}/linux/vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.xz" \ | |
| -o vulkan-sdk.tar.xz | |
| echo "${VULKAN_SDK_LINUX_SHA256} vulkan-sdk.tar.xz" | sha256sum -c - | |
| mkdir -p "$RUNNER_TEMP/vulkan-sdk" | |
| tar -xf vulkan-sdk.tar.xz -C "$RUNNER_TEMP/vulkan-sdk" | |
| source "$RUNNER_TEMP/vulkan-sdk/${VULKAN_SDK_VERSION}/setup-env.sh" | |
| { | |
| echo "VULKAN_SDK=$VULKAN_SDK" | |
| echo "LD_LIBRARY_PATH=$VULKAN_SDK/lib:${LD_LIBRARY_PATH:-}" | |
| } >> "$GITHUB_ENV" | |
| echo "$VULKAN_SDK/bin" >> "$GITHUB_PATH" | |
| "$VULKAN_SDK/bin/glslc" --version | |
| - name: Install Vulkan SDK | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| choco install vulkan-sdk --version="$env:VULKAN_SDK_VERSION" --no-progress -y | |
| $vulkanSdk = Join-Path 'C:\VulkanSDK' $env:VULKAN_SDK_VERSION | |
| if (-not (Test-Path $vulkanSdk)) { | |
| throw "Failed to find Vulkan SDK at $vulkanSdk" | |
| } | |
| "VULKAN_SDK=$vulkanSdk" >> $env:GITHUB_ENV | |
| "$vulkanSdk\Bin" >> $env:GITHUB_PATH | |
| & "$vulkanSdk\Bin\glslc.exe" --version | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build wheel | |
| - name: Install Windows build dependencies | |
| if: runner.os == 'Windows' | |
| run: python -m pip install ninja | |
| - name: Build Vulkan wheel | |
| if: runner.os == 'Linux' | |
| run: | | |
| export CMAKE_ARGS="-DGGML_NATIVE=off -DGGML_METAL=OFF -DGGML_VULKAN=on" | |
| python -m build --wheel | |
| mkdir -p wheelhouse | |
| cp dist/*.whl wheelhouse/ | |
| - name: Build Vulkan wheel | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| $env:CMAKE_GENERATOR = 'Ninja' | |
| $env:CMAKE_ARGS = '-DGGML_NATIVE=off -DGGML_VULKAN=on' | |
| python -m build --wheel | |
| New-Item -ItemType Directory -Force wheelhouse | Out-Null | |
| Copy-Item dist/*.whl wheelhouse/ | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: ./wheelhouse/*.whl | |
| release: | |
| name: Release | |
| needs: [build_wheels] | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| merge-multiple: true | |
| path: dist | |
| - uses: softprops/action-gh-release@v3 | |
| with: | |
| files: dist/* | |
| # Set release name to <tag>-vulkan. | |
| tag_name: ${{ github.ref_name }}-vulkan | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |