fix Windows Vulkan action #73
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, pull_request] | |
| jobs: | |
| desktop: | |
| name: Desktop ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel, ubuntu-24.04-arm] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install Dependencies (Linux) | |
| if: contains(matrix.os, 'ubuntu') | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgles2-mesa-dev glslang-tools | |
| - name: Install Dependencies (macOS) | |
| if: contains(matrix.os, 'macos') | |
| run: brew install glslang | |
| - name: Install Dependencies (Windows) | |
| if: contains(matrix.os, 'windows') | |
| shell: pwsh | |
| run: | | |
| function Find-GlslangValidator { | |
| $cmd = Get-Command glslangValidator -ErrorAction SilentlyContinue | |
| if ($cmd) { return $cmd.Source } | |
| $candidates = @() | |
| if ($env:VULKAN_SDK) { | |
| $candidates += (Join-Path $env:VULKAN_SDK 'Bin\glslangValidator.exe') | |
| } | |
| $candidates += @( | |
| 'C:\VulkanSDK\*\Bin\glslangValidator.exe', | |
| 'C:\Program Files\VulkanSDK\*\Bin\glslangValidator.exe', | |
| "$env:USERPROFILE\VulkanSDK\*\Bin\glslangValidator.exe", | |
| 'C:\ProgramData\chocolatey\lib\vulkan-sdk\tools\**\glslangValidator.exe' | |
| ) | |
| foreach ($pattern in $candidates) { | |
| $found = Get-ChildItem -Path $pattern -File -Recurse -ErrorAction SilentlyContinue | | |
| Sort-Object FullName -Descending | Select-Object -First 1 | |
| if ($found) { return $found.FullName } | |
| } | |
| return $null | |
| } | |
| $ErrorActionPreference = 'Continue' | |
| choco install vulkan-sdk -y | |
| $ErrorActionPreference = 'Stop' | |
| $validator = Find-GlslangValidator | |
| if (-not $validator) { | |
| Write-Host "glslangValidator not found after Chocolatey install, falling back to winget..." | |
| winget install --id KhronosGroup.VulkanSDK --accept-package-agreements --accept-source-agreements --disable-interactivity | |
| $validator = Find-GlslangValidator | |
| } | |
| if (-not $validator) { | |
| throw "glslangValidator.exe not found after Vulkan SDK installation." | |
| } | |
| Write-Host "Using glslangValidator: $validator" | |
| (Split-Path -Parent $validator) | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| & $validator --version | |
| - name: Build Desktop | |
| run: python3 scripts/build.py desktop | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: live2d-desktop-${{ matrix.os }} | |
| path: out/*.jar | |
| android: | |
| name: Android Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Setup Android NDK | |
| uses: nttld/setup-ndk@v1 | |
| with: | |
| ndk-version: r26b | |
| - name: Install Vulkan Shader Compiler | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y glslang-tools | |
| - name: Build Android | |
| run: python3 scripts/build.py android | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: live2d-android | |
| path: out/*.jar |