Skip to content

Commit ea02373

Browse files
committed
Add cross-platform GitHub Actions CI with Vulkan SDK and dependency setup
Introduce a CI workflow to automate builds and tests for Ubuntu, Windows, and macOS. Includes Vulkan SDK installation and essential dependency configurations for each platform.
1 parent b6b2bac commit ea02373

File tree

1 file changed

+146
-0
lines changed

1 file changed

+146
-0
lines changed

.github/workflows/workflow.yml

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: CMake CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [ubuntu-latest, windows-latest, macos-latest]
15+
include:
16+
- os: ubuntu-latest
17+
vulkan-install: |
18+
wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
19+
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
20+
sudo apt-get update
21+
sudo apt-get install -y vulkan-sdk
22+
deps-install: |
23+
sudo apt-get update
24+
sudo apt-get install -y \
25+
libglfw3-dev \
26+
libglm-dev \
27+
libtinyobjloader-dev \
28+
libstb-dev
29+
test-cmd: |
30+
# Check if some of the expected executables were built
31+
if [ -f "00_base_code/00_base_code" ]; then
32+
echo "00_base_code built successfully"
33+
else
34+
echo "00_base_code build failed"
35+
exit 1
36+
fi
37+
38+
if [ -f "15_hello_triangle/15_hello_triangle" ]; then
39+
echo "15_hello_triangle built successfully"
40+
else
41+
echo "15_hello_triangle build failed"
42+
exit 1
43+
fi
44+
45+
if [ -f "31_compute_shader/31_compute_shader" ]; then
46+
echo "31_compute_shader built successfully"
47+
else
48+
echo "31_compute_shader build failed"
49+
exit 1
50+
fi
51+
- os: windows-latest
52+
vulkan-install: |
53+
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe" -OutFile "$env:TEMP\vulkan-sdk.exe"
54+
Start-Process -FilePath "$env:TEMP\vulkan-sdk.exe" -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait
55+
echo "VULKAN_SDK=$env:VULKAN_SDK" >> $env:GITHUB_ENV
56+
deps-install: |
57+
vcpkg install glfw3:x64-windows glm:x64-windows tinyobjloader:x64-windows stb:x64-windows
58+
echo "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV
59+
test-cmd: |
60+
# Check if some of the expected executables were built
61+
if (Test-Path "00_base_code/Release/00_base_code.exe") {
62+
echo "00_base_code built successfully"
63+
} else {
64+
echo "00_base_code build failed"
65+
exit 1
66+
}
67+
68+
if (Test-Path "15_hello_triangle/Release/15_hello_triangle.exe") {
69+
echo "15_hello_triangle built successfully"
70+
} else {
71+
echo "15_hello_triangle build failed"
72+
exit 1
73+
}
74+
75+
if (Test-Path "31_compute_shader/Release/31_compute_shader.exe") {
76+
echo "31_compute_shader built successfully"
77+
} else {
78+
echo "31_compute_shader build failed"
79+
exit 1
80+
}
81+
- os: macos-latest
82+
vulkan-install: |
83+
brew install molten-vk
84+
curl -L -o vulkansdk.dmg "https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.dmg"
85+
hdiutil attach vulkansdk.dmg
86+
sudo /Volumes/vulkansdk/InstallVulkan.app/Contents/MacOS/InstallVulkan --accept-licenses --default-answer --confirm-command install
87+
hdiutil detach /Volumes/vulkansdk
88+
deps-install: |
89+
brew install glfw glm tinyobjloader stb
90+
test-cmd: |
91+
# Check if some of the expected executables were built
92+
if [ -f "00_base_code/00_base_code" ]; then
93+
echo "00_base_code built successfully"
94+
else
95+
echo "00_base_code build failed"
96+
exit 1
97+
fi
98+
99+
if [ -f "15_hello_triangle/15_hello_triangle" ]; then
100+
echo "15_hello_triangle built successfully"
101+
else
102+
echo "15_hello_triangle build failed"
103+
exit 1
104+
fi
105+
106+
if [ -f "31_compute_shader/31_compute_shader" ]; then
107+
echo "31_compute_shader built successfully"
108+
else
109+
echo "31_compute_shader build failed"
110+
exit 1
111+
fi
112+
113+
runs-on: ${{ matrix.os }}
114+
115+
steps:
116+
- uses: actions/checkout@v3
117+
118+
- name: Cache dependencies
119+
uses: actions/cache@v3
120+
with:
121+
path: |
122+
~/.cache/pip
123+
~/.vcpkg
124+
~/Library/Caches/Homebrew
125+
${{ env.VCPKG_INSTALLATION_ROOT }}
126+
key: ${{ runner.os }}-deps-${{ hashFiles('**/CMakeLists.txt') }}
127+
restore-keys: |
128+
${{ runner.os }}-deps-
129+
130+
- name: Install dependencies
131+
run: ${{ matrix.deps-install }}
132+
133+
- name: Install Vulkan SDK
134+
run: ${{ matrix.vulkan-install }}
135+
136+
- name: Configure CMake
137+
working-directory: ${{github.workspace}}/attachments
138+
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
139+
140+
- name: Build
141+
working-directory: ${{github.workspace}}/attachments
142+
run: cmake --build build --config Release
143+
144+
- name: Test Build Output
145+
working-directory: ${{github.workspace}}/attachments/build
146+
run: ${{ matrix.test-cmd }}

0 commit comments

Comments
 (0)