Skip to content

Commit ccc96cb

Browse files
committed
Switch Vulkan SDK back to .tar.gz format and simplify CI workflows
- Revert Vulkan SDK archive back to `.tar.gz` format for improved compatibility. - Remove yaml-cpp build process from Ubuntu CI workflow to streamline dependency installation. - Replace manual Vulkan installation with Chocolatey in Windows CI workflow for simplicity. - Introduce improved caching for Vulkan SDK, dependencies, and build artifacts across platforms.
1 parent c3d12af commit ccc96cb

File tree

1 file changed

+78
-63
lines changed

1 file changed

+78
-63
lines changed

.github/workflows/workflow.yml

Lines changed: 78 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
mkdir -p vulkan-sdk
2424
cd vulkan-sdk
2525
26-
# Download the SDK - try .tar.xz format instead of .tar.gz
27-
curl -O "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz"
26+
# Download the SDK
27+
curl -O "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.gz"
2828
29-
# Extract the SDK - use tar with J flag for xz compression
30-
tar -xJf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz
29+
# Extract the SDK
30+
tar -xzf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.gz
3131
3232
# Set up environment variables
3333
echo "VULKAN_SDK=$PWD/$VULKAN_VERSION/x86_64" >> $GITHUB_ENV
@@ -38,28 +38,13 @@ jobs:
3838
# Return to the original directory
3939
cd ..
4040
deps-install: |
41+
# GitHub runners already have cmake, ninja-build, and clang installed
4142
sudo apt-get update
4243
sudo apt-get install -y \
4344
libglfw3-dev \
4445
libglm-dev \
4546
libtinyobjloader-dev \
46-
libstb-dev \
47-
cmake \
48-
ninja-build \
49-
clang
50-
# Build and install yaml-cpp from source
51-
if [ ! -d "yaml-cpp" ] || [ -z "$(ls -A yaml-cpp)" ]; then
52-
# Directory doesn't exist or is empty, clone the repository
53-
rm -rf yaml-cpp # Remove directory if it exists but is empty
54-
git clone https://github.com/jbeder/yaml-cpp.git
55-
fi
56-
cd yaml-cpp
57-
# Only create build directory if it doesn't exist
58-
if [ ! -d "build" ]; then
59-
cmake -B build -DCMAKE_BUILD_TYPE=Release -DYAML_BUILD_SHARED_LIBS=ON
60-
fi
61-
cmake --build build --config Release -j4
62-
sudo cmake --install build
47+
libstb-dev
6348
test-cmd: |
6449
# Check if some of the expected executables were built
6550
if [ -f "00_base_code/00_base_code" ]; then
@@ -84,42 +69,16 @@ jobs:
8469
fi
8570
- os: windows-latest
8671
vulkan-install: |
87-
# Download the Vulkan SDK installer
88-
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe" -OutFile "$env:TEMP\vulkan-sdk.exe"
89-
90-
# Run the installer with silent options
91-
Start-Process -FilePath "$env:TEMP\vulkan-sdk.exe" -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait -NoNewWindow
92-
93-
# Find the actual installed SDK version
94-
$vulkanPath = Get-ChildItem "C:\VulkanSDK" | Sort-Object -Property Name -Descending | Select-Object -First 1 -ExpandProperty FullName
95-
96-
if (-not $vulkanPath) {
97-
$vulkanPath = "C:\VulkanSDK\latest"
98-
}
72+
# Install Vulkan SDK using Chocolatey (pre-installed on GitHub runners)
73+
choco install vulkan-sdk -y
9974
100-
# Set environment variables with correct Windows-style paths
75+
# Set environment variables
76+
$vulkanPath = "C:\VulkanSDK\latest"
10177
echo "VULKAN_SDK=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
102-
103-
# Add Vulkan SDK to system PATH
10478
echo "$vulkanPath\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
105-
106-
# Set explicit CMake variables
10779
echo "CMAKE_PREFIX_PATH=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
10880
echo "Vulkan_INCLUDE_DIR=$vulkanPath\Include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
10981
echo "Vulkan_LIBRARY=$vulkanPath\Lib\vulkan-1.lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
110-
111-
# Display debug information
112-
Write-Host "Vulkan SDK path: $vulkanPath"
113-
if (Test-Path "$vulkanPath\Lib") {
114-
Write-Host "Lib directory exists"
115-
} else {
116-
Write-Host "Lib directory does not exist"
117-
}
118-
if (Test-Path "$vulkanPath\Include") {
119-
Write-Host "Include directory exists"
120-
} else {
121-
Write-Host "Include directory does not exist"
122-
}
12382
deps-install: |
12483
vcpkg install glfw3:x64-windows glm:x64-windows tinyobjloader:x64-windows stb:x64-windows
12584
echo "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV
@@ -151,26 +110,51 @@ jobs:
151110
steps:
152111
- uses: actions/checkout@v3
153112

154-
- name: Cache dependencies (Windows)
113+
# Cache vcpkg packages for Windows
114+
- name: Cache vcpkg packages (Windows)
155115
if: runner.os == 'Windows'
156116
uses: actions/cache@v3
157117
with:
158118
path: |
159-
${{ env.VCPKG_INSTALLATION_ROOT }}
160-
key: ${{ runner.os }}-deps-${{ hashFiles('**/CMakeLists.txt') }}
119+
${{ env.VCPKG_INSTALLATION_ROOT }}/installed
120+
${{ env.VCPKG_INSTALLATION_ROOT }}/packages
121+
${{ env.VCPKG_INSTALLATION_ROOT }}/buildtrees
122+
key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}
123+
restore-keys: |
124+
${{ runner.os }}-vcpkg-${{ hashFiles('**/CMakeLists.txt') }}-
125+
${{ runner.os }}-vcpkg-
126+
127+
# Cache Vulkan SDK for Windows
128+
- name: Cache Vulkan SDK (Windows)
129+
if: runner.os == 'Windows'
130+
uses: actions/cache@v3
131+
with:
132+
path: C:\VulkanSDK
133+
key: ${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/CMakeLists.txt') }}
134+
restore-keys: |
135+
${{ runner.os }}-vulkan-sdk-
136+
137+
# Cache apt packages for Ubuntu
138+
- name: Cache apt packages (Ubuntu)
139+
if: runner.os == 'Linux'
140+
uses: actions/cache@v3
141+
with:
142+
path: /var/cache/apt/archives
143+
key: ${{ runner.os }}-apt-${{ hashFiles('**/workflow.yml') }}
161144
restore-keys: |
162-
${{ runner.os }}-deps-
145+
${{ runner.os }}-apt-
163146
164-
- name: Cache dependencies (Ubuntu)
147+
# Cache Vulkan SDK for Ubuntu
148+
- name: Cache Vulkan SDK (Ubuntu)
165149
if: runner.os == 'Linux'
166150
uses: actions/cache@v3
167151
with:
168152
path: |
169-
${{ github.workspace }}/yaml-cpp/build
170153
${{ github.workspace }}/vulkan-sdk
171-
key: ${{ runner.os }}-deps-${{ hashFiles('**/CMakeLists.txt') }}
154+
key: ${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}
172155
restore-keys: |
173-
${{ runner.os }}-deps-
156+
${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/CMakeLists.txt') }}-
157+
${{ runner.os }}-vulkan-sdk-
174158
175159
- name: Install dependencies
176160
run: ${{ matrix.deps-install }}
@@ -183,15 +167,23 @@ jobs:
183167
run: |
184168
if (Test-Path $env:VULKAN_SDK) {
185169
echo "Vulkan SDK found at: $env:VULKAN_SDK"
186-
echo "Contents of Lib directory:"
187-
Get-ChildItem "$env:VULKAN_SDK\Lib"
188-
echo "Contents of Include directory:"
189-
Get-ChildItem "$env:VULKAN_SDK\Include"
170+
echo "Vulkan SDK installation verified"
190171
} else {
191172
echo "Vulkan SDK not found!"
192173
exit 1
193174
}
194175
176+
# Cache CMake build directory for Windows
177+
- name: Cache build artifacts (Windows)
178+
if: runner.os == 'Windows'
179+
uses: actions/cache@v3
180+
with:
181+
path: ${{github.workspace}}/attachments/build
182+
key: ${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}-${{ hashFiles('**/*.h') }}
183+
restore-keys: |
184+
${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-
185+
${{ runner.os }}-build-
186+
195187
- name: Configure CMake (Windows)
196188
working-directory: ${{github.workspace}}/attachments
197189
if: runner.os == 'Windows'
@@ -208,6 +200,29 @@ jobs:
208200
Get-Content "build/CMakeCache.txt" | Select-String -Pattern "Vulkan"
209201
}
210202
203+
# Verify Vulkan Installation for Ubuntu
204+
- name: Verify Vulkan Installation (Ubuntu)
205+
if: runner.os == 'Linux'
206+
run: |
207+
if [ -d "$VULKAN_SDK" ]; then
208+
echo "Vulkan SDK found at: $VULKAN_SDK"
209+
echo "Vulkan SDK installation verified"
210+
else
211+
echo "Vulkan SDK not found!"
212+
exit 1
213+
fi
214+
215+
# Cache CMake build directory for Ubuntu
216+
- name: Cache build artifacts (Ubuntu)
217+
if: runner.os == 'Linux'
218+
uses: actions/cache@v3
219+
with:
220+
path: ${{github.workspace}}/attachments/build
221+
key: ${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}-${{ hashFiles('**/*.h') }}
222+
restore-keys: |
223+
${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-
224+
${{ runner.os }}-build-
225+
211226
- name: Configure CMake (Unix)
212227
working-directory: ${{github.workspace}}/attachments
213228
if: runner.os != 'Windows'

0 commit comments

Comments
 (0)