-
Notifications
You must be signed in to change notification settings - Fork 34
269 lines (245 loc) · 9.47 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
name: Build Code
on:
push:
pull_request:
types: [opened]
env:
INEXOR_VULKAN_VERSION: "1.3.283.0"
INEXOR_VULKAN_SDK_PATH: "$GITHUB_WORKSPACE/../vulkan_sdk/"
INEXOR_VULKAN_SDK_CHECKSUM_LINUX: "8005e2cf3e89c80cbe1c0d0a259c88248de3257b4fc6fdefb47409edb3e43ecb"
INEXOR_VULKAN_SDK_CHECKSUM_WINDOWS: "811fcb9b43d09248520b2f38ae9a3763fc81df950fdab874f23bd762b07a9b12"
jobs:
linux:
name: ${{ matrix.config.name }}
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' && !github.event.pull_request.merged || github.event_name == 'push' }}
container: ubuntu:rolling
env:
DEBIAN_FRONTEND: "noninteractive"
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu Clang (Debug)",
compiler: "clang",
cc: "clang-14", cxx: "clang++-14",
build_type: "Debug"
}
- {
name: "Ubuntu Clang (Release)",
compiler: "clang",
cc: "clang-14", cxx: "clang++-14",
build_type: "Release"
}
- {
name: "Ubuntu GCC (Debug)",
compiler: "gcc",
cc: "gcc-14", cxx: "g++-14",
build_type: "Debug"
}
- {
name: "Ubuntu GCC (Release)",
compiler: "gcc",
cc: "gcc-14", cxx: "g++-14",
build_type: "Release"
}
steps:
- name: Update environment
shell: bash
run: |
# Update package lists
apt update -qq
# Install build tools
apt-get install -y \
gcc-12 \
clang-14 \
cmake \
curl \
git \
libgl1-mesa-dev \
libx11-dev \
libx11-xcb-dev \
libxcb-dri3-dev \
libxcb-icccm4-dev \
libxcb-image0-dev \
libxcb-keysyms1-dev \
libxcb-randr0-dev \
libxcb-render-util0-dev \
libxcb-render0-dev \
libxcb-shape0-dev \
libxcb-sync-dev \
libxcb-util-dev \
libxcb-xfixes0-dev \
libxcb-xinerama0-dev \
libxcb-xkb-dev \
lld \
ninja-build \
pkg-config \
python3 \
python3-pip \
xkb-data \
xorg-dev \
xz-utils
pip3 install --break-system-packages wheel setuptools
- name: Install Vulkan SDK
shell: bash
run: |
curl -LS -o vulkansdk.tar.xz https://sdk.lunarg.com/sdk/download/${{ env.INEXOR_VULKAN_VERSION }}/linux/vulkansdk-linux-x86_64-${{ env.INEXOR_VULKAN_VERSION }}.tar.xz
echo "${{ env.INEXOR_VULKAN_SDK_CHECKSUM_LINUX }} vulkansdk.tar.xz" | sha256sum --check
mkdir -p ${{ env.INEXOR_VULKAN_SDK_PATH }}
tar xf vulkansdk.tar.xz -C "${{ env.INEXOR_VULKAN_SDK_PATH }}"
rm -rf vulkansdk.tar.xz
# runtime depenedencies
apt-get -y install qtbase5-dev libxcb-xinput0 libxcb-xinerama0
- name: Checkout
uses: actions/checkout@v3
- name: Configure CMake
shell: bash
run: |
export CC=${{ matrix.config.cc }}
export CXX=${{ matrix.config.cxx }}
export VULKAN_SDK="${{ env.INEXOR_VULKAN_SDK_PATH }}/${{ env.INEXOR_VULKAN_VERSION }}/x86_64"
export PATH=$VULKAN_SDK/bin:$PATH
export LD_LIBRARY_PATH=$VULKAN_SDK/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export VK_LAYER_PATH=$VULKAN_SDK/share/vulkan/explicit_layer.d
cmake . \
-Bbuild \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-DINEXOR_BUILD_BENCHMARKS=ON \
-DINEXOR_BUILD_TESTS=ON \
-DCMAKE_CXX_FLAGS="-Wall -Wextra" \
-GNinja \
${{ matrix.config.cmake_configure_options }}
- name: Build
shell: bash
run: |
cmake --build build
- name: Prepare Build Artifacts
shell: bash
run: |
cd build
tar -zcvf "../build_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz" *
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: build_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz
path: build_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz
- name: Prepare Nightly Artifacts
shell: bash
run: |
mkdir artifacts
cp ./build/example/inexor-vulkan-renderer-example artifacts/
cp -r ./configuration/ artifacts/
cp -r ./assets/ artifacts
mkdir -p ./artifacts/shaders
cp ./shaders/*.spv ./artifacts/shaders/
cd artifacts
tar -zcvf "../nightly_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz" *
- name: Upload Nightly Artifacts
uses: actions/upload-artifact@v3
with:
name: nightly_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz
path: nightly_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz
retention-days: 7
windows:
name: ${{ matrix.config.name }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows MSVC (Debug)",
compiler: "msvc",
cc: "cl", cxx: "cl",
cmake_configure_options: '-G "Visual Studio 17 2022" -A x64',
build_type: "Debug",
cmake_build_options: "--config Debug",
}
- {
name: "Windows MSVC (Release)",
compiler: "msvc",
cc: "cl", cxx: "cl",
cmake_configure_options: '-G "Visual Studio 17 2022" -A x64',
build_type: "Release",
cmake_build_options: "--config Release",
}
- {
name: "Windows Clang (Debug)",
compiler: "clang",
cc: "clang-cl", cxx: "clang-cl",
cmake_configure_options: '-G "Visual Studio 17 2022" -A x64 -T "LLVM_v143" -DCMAKE_CXX_COMPILER="clang-cl.exe" -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_LINKER="lld.exe"',
build_type: "Debug",
cmake_build_options: "--config Debug",
}
- {
name: "Windows Clang (Release)",
compiler: "clang",
cc: "clang-cl", cxx: "clang-cl",
cmake_configure_options: '-G "Visual Studio 17 2022" -A x64 -T "LLVM_v143" -DCMAKE_CXX_COMPILER="clang-cl.exe" -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_LINKER="lld.exe"',
build_type: "Release",
cmake_build_options: "--config Release",
}
steps:
- name: Update environment
shell: pwsh
run: |
pip3 install wheel setuptools
- name: Checkout
uses: actions/checkout@v3
- name: Configure LLVM
if: matrix.config.compiler == 'clang'
shell: pwsh
run: |
choco upgrade --no-progress llvm
curl -fsSL -o "LLVM_VS2017.zip" "https://github.com/zufuliu/llvm-utils/releases/download/v23.03/LLVM_VS2017.zip"
7z x -y "LLVM_VS2017.zip" >NUL
LLVM_VS2017\install.bat
- name: Install Vulkan SDK
shell: pwsh
run: |
curl -LS -o vulkansdk.exe https://sdk.lunarg.com/sdk/download/${{ env.INEXOR_VULKAN_VERSION }}/windows/VulkanSDK-${{ env.INEXOR_VULKAN_VERSION }}-Installer.exe
7z x vulkansdk.exe -o"${{ env.INEXOR_VULKAN_SDK_PATH }}"
- name: Configure CMake
shell: pwsh
run: |
$env:CC="${{ matrix.config.cc }}"
$env:CXX="${{ matrix.config.cxx }}"
$env:Path += ";${{ env.INEXOR_VULKAN_SDK_PATH }}\;${{ env.INEXOR_VULKAN_SDK_PATH }}\Bin\"
# TODO: Bring back Google tests and benchmarks in Windows CI
cmake . `
-Bbuild `
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} `
-DINEXOR_BUILD_BENCHMARKS=OFF `
-DINEXOR_BUILD_TESTS=OFF `
${{ matrix.config.cmake_configure_options }}
- name: Build
shell: pwsh
run: |
cmake --build build ${{ matrix.config.cmake_build_options }}
- name: Prepare Build Artifacts
shell: pwsh
run: |
7z a -tzip "build_windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}" ./build/*
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: build_windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}
path: build_windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.zip
- name: Prepare Nightly Artifacts
shell: pwsh
run: |
mkdir artifacts
cp -r ./build/example/${{ matrix.config.build_type }}/inexor-vulkan-renderer-example.exe artifacts
cp -r ./configuration/. artifacts
cp -r ./assets/. artifacts
mkdir -P ./artifacts/shaders
cp ./shaders/*.spv ./artifacts/shaders/
7z a -tzip "nightly_windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}" ./artifacts/*
- name: Upload Nightly Artifacts
uses: actions/upload-artifact@v3
with:
name: nightly_windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}
path: nightly_windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.zip
retention-days: 7