Skip to content

Commit 66a00ae

Browse files
committed
Refine Windows CI Vulkan SDK setup: improve caching logic, enhance diagnostics, and dynamically pass Vulkan paths to CMake configuration.
1 parent 9475cc5 commit 66a00ae

File tree

1 file changed

+50
-23
lines changed

1 file changed

+50
-23
lines changed

.github/workflows/simple_engine_ci.yml

Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -84,43 +84,61 @@ jobs:
8484
key: ${{ runner.os }}-vulkan-sdk
8585

8686
- name: Install Vulkan SDK (Windows)
87-
if: runner.os == 'Windows' && steps.cache-vulkan-windows.outputs.cache-hit != 'true'
87+
if: runner.os == 'Windows'
8888
shell: pwsh
8989
run: |
9090
$ErrorActionPreference = 'Stop'
9191
92-
if (-not (Get-Command choco -ErrorAction SilentlyContinue)) {
93-
throw "Chocolatey is required on windows-latest runners"
94-
}
95-
96-
if (Test-Path "C:\VulkanSDK") {
97-
Write-Host "Using existing Vulkan SDK at C:\VulkanSDK"
92+
if ("${{ steps.cache-vulkan-windows.outputs.cache-hit }}" -ne "true") {
93+
if (-not (Get-Command choco -ErrorAction SilentlyContinue)) {
94+
throw "Chocolatey is required on windows-latest runners"
95+
}
96+
97+
if (Test-Path "C:\VulkanSDK") {
98+
Write-Host "Using existing Vulkan SDK at C:\VulkanSDK"
99+
} else {
100+
Write-Host "Downloading Vulkan SDK installer..."
101+
choco install -y aria2
102+
$installer = Join-Path $env:TEMP "vulkan-sdk.exe"
103+
aria2c --split=8 --max-connection-per-server=8 --min-split-size=1M --dir="$env:TEMP" --out="vulkan-sdk.exe" "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe"
104+
105+
Write-Host "Installing Vulkan SDK (silent, default feature set)..."
106+
# NOTE: Do not pass --components here. LunarG has changed component IDs over time,
107+
# and specifying them can cause 'Component(s) not found' failures.
108+
Start-Process -FilePath $installer -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait -NoNewWindow
109+
}
98110
} else {
99-
Write-Host "Downloading Vulkan SDK installer..."
100-
choco install -y aria2
101-
$installer = Join-Path $env:TEMP "vulkan-sdk.exe"
102-
aria2c --split=8 --max-connection-per-server=8 --min-split-size=1M --dir="$env:TEMP" --out="vulkan-sdk.exe" "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe"
103-
104-
Write-Host "Installing Vulkan SDK (silent, default feature set)..."
105-
# NOTE: Do not pass --components here. LunarG has changed component IDs over time,
106-
# and specifying them can cause 'Component(s) not found' failures.
107-
Start-Process -FilePath $installer -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait -NoNewWindow
111+
Write-Host "Vulkan SDK cache hit. Setting up environment..."
108112
}
109113
110114
$vulkanPath = ""
111115
if (Test-Path "C:\VulkanSDK") {
112116
$vulkanPath = Get-ChildItem "C:\VulkanSDK" | Sort-Object -Property Name -Descending | Select-Object -First 1 -ExpandProperty FullName
113117
}
114118
if (-not $vulkanPath) {
115-
throw "Vulkan SDK not found after install"
119+
throw "Vulkan SDK not found after install/cache restore"
116120
}
117121
122+
Write-Host "Found Vulkan SDK at: $vulkanPath"
118123
"VULKAN_SDK=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
119124
"$vulkanPath\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
120125
"CMAKE_PREFIX_PATH=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
121126
"Vulkan_INCLUDE_DIR=$vulkanPath\Include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
122127
"Vulkan_LIBRARY=$vulkanPath\Lib\vulkan-1.lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
123128
129+
- name: Vulkan SDK diagnostics (Windows)
130+
if: runner.os == 'Windows'
131+
shell: pwsh
132+
run: |
133+
Write-Host "VULKAN_SDK: $env:VULKAN_SDK"
134+
Write-Host "Vulkan_INCLUDE_DIR: $env:Vulkan_INCLUDE_DIR"
135+
Write-Host "Vulkan_LIBRARY: $env:Vulkan_LIBRARY"
136+
if (Test-Path "$env:Vulkan_INCLUDE_DIR\vulkan\vulkan.hpp") {
137+
Write-Host "vulkan.hpp found"
138+
} else {
139+
Write-Warning "vulkan.hpp NOT found at $env:Vulkan_INCLUDE_DIR\vulkan\vulkan.hpp"
140+
}
141+
124142
- name: Cache Vulkan SDK (Linux)
125143
if: runner.os == 'Linux'
126144
id: cache-vulkan-linux
@@ -365,12 +383,21 @@ jobs:
365383
- name: Configure (Windows)
366384
if: runner.os == 'Windows'
367385
shell: pwsh
368-
run: >
369-
cmake -S . -B build -G Ninja
370-
-DCMAKE_BUILD_TYPE=Release
371-
-DCMAKE_TOOLCHAIN_FILE="$env:CMAKE_TOOLCHAIN_FILE"
372-
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
373-
-DCMAKE_C_COMPILER_LAUNCHER=sccache
386+
run: |
387+
$extraArgs = @()
388+
if ($env:Vulkan_INCLUDE_DIR) {
389+
$extraArgs += "-DVulkan_INCLUDE_DIR=$env:Vulkan_INCLUDE_DIR"
390+
}
391+
if ($env:Vulkan_LIBRARY) {
392+
$extraArgs += "-DVulkan_LIBRARY=$env:Vulkan_LIBRARY"
393+
}
394+
395+
cmake -S . -B build -G Ninja `
396+
-DCMAKE_BUILD_TYPE=Release `
397+
-DCMAKE_TOOLCHAIN_FILE="$env:CMAKE_TOOLCHAIN_FILE" `
398+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache `
399+
-DCMAKE_C_COMPILER_LAUNCHER=sccache `
400+
$extraArgs
374401
375402
- name: Configure (Linux)
376403
if: runner.os == 'Linux'

0 commit comments

Comments
 (0)