Debian Codegraph @

.github/workflows/build.yml

raw symbols SCIP
1 # Copyright (c) 2021-2024 Valve Corporation
2 # Copyright (c) 2021-2024 LunarG, Inc.
3
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # Author: Lenny Komow <[email protected]>
17 # Author: Charles Giessen <[email protected]>
18
19 name: CI Build
20
21 # https://docs.github.com/en/actions/using-jobs/using-concurrency
22 concurrency:
23 # github.head_ref is only defined on pull_request
24 # Fallback to the run ID, which is guaranteed to be both unique and defined for the run.
25 group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
26 cancel-in-progress: true
27
28 on:
29 push:
30 pull_request:
31 branches:
32 - main
33
34 permissions: read-all
35
36 jobs:
37 linux:
38 needs: codegen
39 runs-on: ${{matrix.os}}
40 timeout-minutes: 30
41 strategy:
42 matrix:
43 compiler: [ {cc: gcc, cxx: g++}, {cc: clang, cxx: clang++} ]
44 config: [ Debug, Release ]
45 os: [ ubuntu-22.04, ubuntu-24.04 ]
46 steps:
47 - uses: actions/[email protected]
48 - uses: actions/setup-python@v6
49 with:
50 python-version: '3.11'
51 - name: Test CMake min
52 # NOTE: The main users who benefit from an older CMake version
53 # are linux users stuck on older LTS releases. It's idiomatic best
54 # practice to try and support them so they don't have to install
55 # the CMake tarball. Ideally the minimum we use matches what the default
56 # package provided by Ubuntu via APT.
57 if: ${{ matrix.os == 'ubuntu-22.04' }}
58 uses: lukka/get-cmake@latest
59 with:
60 cmakeVersion: 3.22.1
61 - run: sudo apt update
62 - run: sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev
63 - run: |
64 cmake -S. -B build \
65 -D CMAKE_BUILD_TYPE=${{ matrix.config }} \
66 -D BUILD_TESTS=ON \
67 -D UPDATE_DEPS=ON \
68 -D LOADER_ENABLE_ADDRESS_SANITIZER=ON \
69 -D BUILD_WERROR=ON \
70 -D CMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} \
71 -D CMAKE_C_COMPILER=${{ matrix.compiler.cc }}
72 - run: cmake --build build
73 - run: ctest --parallel --output-on-failure --test-dir build/
74 - run: cmake --install build --prefix /tmp
75
76 codegen:
77 runs-on: ubuntu-latest
78 timeout-minutes: 30
79 steps:
80 - uses: actions/[email protected]
81 - run: scripts/update_deps.py --dir ext --no-build
82 - run: scripts/generate_source.py --verify ext/Vulkan-Headers/registry/
83
84 linux-no-asm:
85 needs: codegen
86 runs-on: ubuntu-24.04
87 timeout-minutes: 30
88 steps:
89 - uses: actions/[email protected]
90 - run: sudo apt update
91 - run: sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev
92 - run: |
93 cmake -S. -B build \
94 -D CMAKE_BUILD_TYPE=Release \
95 -D BUILD_TESTS=ON \
96 -D UPDATE_DEPS=ON \
97 -D BUILD_WERROR=ON \
98 -D USE_GAS=OFF \
99 -D CMAKE_C_COMPILER=clang \
100 -D CMAKE_CXX_COMPILER=clang++
101 - run: cmake --build build
102 - run: cmake --install build --prefix /tmp
103 - run: ctest --parallel --output-on-failure -E UnknownFunction --test-dir build/
104
105 linux-32:
106 needs: codegen
107 runs-on: ubuntu-24.04
108 timeout-minutes: 30
109 strategy:
110 matrix:
111 config: [ Debug, Release ]
112 steps:
113 - uses: actions/[email protected]
114 - uses: actions/setup-python@v6
115 with:
116 python-version: '3.11'
117 - uses: lukka/get-cmake@latest
118 with:
119 cmakeVersion: 3.22.1
120 - name: Enable 32 bit
121 run: sudo dpkg --add-architecture i386
122 - run: sudo apt-get update
123 - run: |
124 sudo apt install --yes --no-install-recommends \
125 gcc-multilib g++-multilib libc6:i386 libc6-dev-i386 libgcc-s1:i386 \
126 libwayland-dev:i386 libxrandr-dev:i386
127 - run: |
128 cmake -S. -B build \
129 -D CMAKE_BUILD_TYPE=${{matrix.config}} \
130 -D BUILD_TESTS=ON \
131 -D UPDATE_DEPS=ON \
132 -D BUILD_WERROR=ON \
133 -D SYSCONFDIR=/etc/not_vulkan \
134 -D CMAKE_CXX_FLAGS=-m32 \
135 -D CMAKE_C_FLAGS=-m32 \
136 -G Ninja
137 env:
138 # https://gitlab.kitware.com/cmake/cmake/-/issues/25317
139 PKG_CONFIG_PATH: /usr/lib/i386-linux-gnu/pkgconfig
140 - run: cmake --build build
141 - run: cmake --install build --prefix /tmp
142 - run: ctest --parallel --output-on-failure --test-dir build/
143
144 linux-32-no-asm:
145 needs: codegen
146 runs-on: ubuntu-24.04
147 timeout-minutes: 30
148 steps:
149 - uses: actions/[email protected]
150 - uses: actions/setup-python@v6
151 with:
152 python-version: '3.11'
153 - uses: lukka/get-cmake@latest
154 with:
155 cmakeVersion: 3.22.1
156 - name: Enable 32 bit
157 run: sudo dpkg --add-architecture i386
158 - run: sudo apt-get update
159 - run: |
160 sudo apt install --yes --no-install-recommends \
161 gcc-multilib g++-multilib libc6:i386 libc6-dev-i386 libgcc-s1:i386 \
162 libwayland-dev:i386 libxrandr-dev:i386
163 - run: |
164 cmake -S. -B build \
165 -D CMAKE_BUILD_TYPE=Release \
166 -D BUILD_TESTS=ON \
167 -D UPDATE_DEPS=ON \
168 -D BUILD_WERROR=ON \
169 -D USE_GAS=OFF \
170 -D CMAKE_CXX_FLAGS=-m32 \
171 -D CMAKE_C_FLAGS=-m32 \
172 -G Ninja
173 env:
174 # https://gitlab.kitware.com/cmake/cmake/-/issues/25317
175 PKG_CONFIG_PATH: /usr/lib/i386-linux-gnu/pkgconfig
176 - run: cmake --build build
177 - run: ctest --parallel --output-on-failure -E UnknownFunction --test-dir build/
178
179 linux-arm:
180 needs: codegen
181 runs-on: ubuntu-24.04-arm
182 timeout-minutes: 30
183 steps:
184 - uses: actions/[email protected]
185 - uses: actions/setup-python@v6
186 with:
187 python-version: '3.11'
188 - name: Test CMake min
189 uses: lukka/get-cmake@latest
190 with:
191 cmakeVersion: 3.22.1
192 - run: sudo apt update
193 - run: sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev
194 - run: |
195 cmake -S. -B build \
196 -D CMAKE_BUILD_TYPE=Debug \
197 -D BUILD_TESTS=ON \
198 -D UPDATE_DEPS=ON \
199 -D LOADER_ENABLE_ADDRESS_SANITIZER=ON \
200 -D BUILD_WERROR=ON
201 - run: cmake --build build
202 - run: ctest --parallel --output-on-failure --test-dir build/
203 - run: cmake --install build --prefix /tmp
204
205 windows_vs:
206 # windows is 2x expensive to run on GitHub machines, so only run if we know something else simple passed as well
207 needs: linux-no-asm
208 runs-on: windows-latest
209 timeout-minutes: 30
210 strategy:
211 matrix:
212 arch: [ Win32, x64 ]
213 config: [ Debug, Release ]
214 steps:
215 - uses: actions/[email protected]
216 - run: |
217 cmake -S. -B build `
218 -D BUILD_TESTS=ON `
219 -D UPDATE_DEPS=ON `
220 -D CMAKE_BUILD_TYPE=${{matrix.config}} `
221 -A ${{ matrix.arch }} `
222 -D BUILD_WERROR=ON
223 - run: cmake --build build/ --config ${{matrix.config}}
224 - run: cmake --install build --prefix build/install --config ${{matrix.config}}
225 - run: ctest --parallel --output-on-failure -C ${{matrix.config}} --test-dir build/
226
227 windows_vs-no-asm:
228 # windows is 2x expensive to run on GitHub machines, so only run if we know something else simple passed as well
229 needs: linux-no-asm
230 runs-on: windows-latest
231 timeout-minutes: 30
232 strategy:
233 matrix:
234 arch: [ Win32, x64 ]
235 steps:
236 - uses: actions/[email protected]
237 - run: |
238 cmake -S. -B build `
239 -D BUILD_TESTS=ON `
240 -D UPDATE_DEPS=ON `
241 -D USE_MASM=OFF `
242 -D CMAKE_BUILD_TYPE=Release `
243 -A ${{ matrix.arch }} `
244 -D BUILD_WERROR=ON
245 - run: cmake --build build/ --config Release
246 - run: ctest --parallel --output-on-failure -C Release -E UnknownFunction --test-dir build/
247
248 # Test both clang and clang-cl (Chromium project uses clang-cl)
249 windows_clang:
250 # windows is 2x expensive to run on GitHub machines, so only run if we know something else simple passed as well
251 needs: linux-no-asm
252 runs-on: windows-2022
253 timeout-minutes: 30
254 strategy:
255 matrix:
256 compiler: [ clang, clang-cl ]
257 config: [ Debug, Release ]
258 steps:
259 - uses: actions/[email protected]
260 - uses: ilammy/msvc-dev-cmd@v1
261 - run: |
262 cmake -S. -B build `
263 -D CMAKE_C_COMPILER=${{matrix.compiler}} `
264 -D CMAKE_CXX_COMPILER=${{matrix.compiler}} `
265 -D UPDATE_DEPS=ON `
266 -D CMAKE_BUILD_TYPE=${{matrix.config}} `
267 -D BUILD_WERROR=ON `
268 -D BUILD_TESTS=ON `
269 -G Ninja
270 - run: cmake --build build/
271 - run: ctest --parallel --output-on-failure --test-dir build/
272 - run: cmake --install build --prefix build/install
273
274 mac:
275 # Mac is 10x expensive to run on GitHub machines, so only run if we know something else passed as well
276 needs: windows_clang
277 runs-on: macos-14
278 timeout-minutes: 30
279 strategy:
280 matrix:
281 config: [ Debug, Release ]
282 static_build: [ APPLE_STATIC_LOADER=ON, APPLE_STATIC_LOADER=OFF ]
283 steps:
284 - uses: actions/[email protected]
285 - uses: actions/setup-python@v6
286 with:
287 python-version: '3.11'
288 - run: |
289 cmake -S. -B build \
290 -D CMAKE_BUILD_TYPE=${{matrix.config}} \
291 -D ${{matrix.static_build}} \
292 -D BUILD_TESTS=ON \
293 -D UPDATE_DEPS=ON \
294 -D BUILD_WERROR=ON \
295 -D LOADER_ENABLE_ADDRESS_SANITIZER=ON \
296 -G Ninja
297 env:
298 # Prevents regression of KhronosGroup/Vulkan-Loader/issues/1332
299 LDFLAGS: -Wl,-fatal_warnings
300 - run: cmake --build build
301 - run: cmake --install build --prefix /tmp
302 - run: ctest --parallel --output-on-failure --test-dir build/
303
304 apple-cross-compile:
305 # Mac is 10x expensive to run on GitHub machines, so only run if we know something else passed as well
306 needs: windows_clang
307 name: ${{ matrix.CMAKE_SYSTEM_NAME }}
308 runs-on: macos-14
309 timeout-minutes: 30
310 strategy:
311 matrix:
312 CMAKE_SYSTEM_NAME: [ iOS, tvOS ]
313 steps:
314 - uses: actions/[email protected]
315 - uses: actions/setup-python@v6
316 with:
317 python-version: '3.11'
318 - run: |
319 cmake -S . -B build \
320 -D CMAKE_SYSTEM_NAME=${{ matrix.CMAKE_SYSTEM_NAME }} \
321 "-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64" \
322 -D CMAKE_BUILD_TYPE=Debug \
323 -D UPDATE_DEPS=ON \
324 -D BUILD_WERROR=ON \
325 -G Ninja
326 env:
327 LDFLAGS: -Wl,-fatal_warnings
328 - run: cmake --build build
329 - run: cmake --install build --prefix /tmp
330 - name: Verify Universal Binary
331 run: |
332 vtool -show-build /tmp/lib/libvulkan.dylib | grep 'architecture x86_64'
333 vtool -show-build /tmp/lib/libvulkan.dylib | grep 'architecture arm64'
334
335 # Building a universal binary disables assembly automatically
336 # Furthermore the Vulkan SDK ships universal binaries
337 mac-univeral:
338 # Mac is 10x expensive to run on GitHub machines, so only run if we know something else passed as well
339 needs: windows_clang
340 name: "Universal Binary Testing (STATIC ${{ matrix.static }}) w/ ${{ matrix.generator }}"
341 runs-on: macos-latest
342 timeout-minutes: 30
343 strategy:
344 matrix:
345 static: [ 'ON', 'OFF' ]
346 generator: [ Ninja, Xcode ]
347 steps:
348 - uses: actions/[email protected]
349 - uses: actions/setup-python@v6
350 with:
351 python-version: '3.11'
352 - run: |
353 cmake -S. -B build \
354 -D CMAKE_BUILD_TYPE=Release \
355 -D APPLE_STATIC_LOADER=${{matrix.static}} \
356 "-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64" \
357 -D BUILD_TESTS=ON \
358 -D UPDATE_DEPS=ON \
359 -D BUILD_WERROR=ON \
360 -G ${{ matrix.generator }}
361 env:
362 LDFLAGS: -Wl,-fatal_warnings
363 - run: cmake --build build --config Release
364 - run: ctest --parallel --output-on-failure --build-config Release -E UnknownFunction --test-dir build/
365 - run: cmake --install build --config Release --prefix /tmp
366 - name: Verify Universal Binary
367 if: ${{ matrix.static == 'OFF' }}
368 run: |
369 vtool -show-build /tmp/lib/libvulkan.dylib | grep 'architecture x86_64'
370 vtool -show-build /tmp/lib/libvulkan.dylib | grep 'architecture arm64'
371
372 chromium:
373 needs: codegen
374 runs-on: ubuntu-latest
375 timeout-minutes: 30
376 steps:
377 - uses: actions/[email protected]
378 - run: scripts/gn/gn.py
379
380 mingw:
381 # windows is 2x expensive to run on GitHub machines, so only run if we know something else simple passed as well
382 needs: linux-no-asm
383 if: false # Disabled due to issues with msys2 making CMake unable to find a working compiler
384 runs-on: windows-2022
385 timeout-minutes: 30
386 defaults:
387 run:
388 shell: bash
389 steps:
390 - uses: actions/[email protected]
391 - uses: actions/setup-python@v6
392 with:
393 python-version: '3.11'
394 - name: Setup uasm
395 run: |
396 C:/msys64/usr/bin/pacman -Sy --noconfirm --needed mingw-w64-x86_64-uasm
397 printf '%s\n' 'C:/msys64/mingw64/bin' >> $GITHUB_PATH
398 - name: UASM Check
399 run: uasm -?
400 - run: |
401 cmake -S. -B build \
402 -D UPDATE_DEPS=ON \
403 -D CMAKE_BUILD_TYPE=Release \
404 -D BUILD_WERROR=ON \
405 -G Ninja
406 - run: cmake --build build
407 - run: cmake --install build --prefix /tmp
408
409 mingw-use-gas:
410 # windows is 2x expensive to run on GitHub machines, so only run if we know something else simple passed as well
411 needs: linux-no-asm
412 runs-on: windows-2022
413 timeout-minutes: 30
414 defaults:
415 run:
416 shell: bash
417 steps:
418 - uses: actions/[email protected]
419 - uses: actions/setup-python@v6
420 with:
421 python-version: '3.11'
422 - run: |
423 cmake -S. -B build \
424 -D UPDATE_DEPS=ON \
425 -D CMAKE_BUILD_TYPE=Release \
426 -D BUILD_WERROR=ON \
427 -D USE_GAS=ON \
428 -G Ninja
429 - run: cmake --build build
430 - run: cmake --install build --prefix /tmp
431
432 mingw-no-asm:
433 # windows is 2x expensive to run on GitHub machines, so only run if we know something else simple passed as well
434 needs: linux-no-asm
435 runs-on: windows-2022
436 timeout-minutes: 30
437 defaults:
438 run:
439 shell: bash
440 steps:
441 - uses: actions/[email protected]
442 - uses: actions/setup-python@v6
443 with:
444 python-version: '3.11'
445 # Make sure this doesn't fail even without explicitly setting '-D USE_MASM=OFF' and without uasm
446 - run: |
447 cmake -S. -B build \
448 -D UPDATE_DEPS=ON \
449 -D CMAKE_BUILD_TYPE=Release \
450 -D BUILD_WERROR=ON \
451 -G Ninja
452 - run: cmake --build build
453 - run: cmake --install build --prefix /tmp
454
455 mingw-no-asm-explicit:
456 # windows is 2x expensive to run on GitHub machines, so only run if we know something else simple passed as well
457 needs: linux-no-asm
458 runs-on: windows-2022
459 timeout-minutes: 30
460 defaults:
461 run:
462 shell: bash
463 steps:
464 - uses: actions/[email protected]
465 - run: |
466 cmake -S. -B build \
467 -D UPDATE_DEPS=ON \
468 -D CMAKE_BUILD_TYPE=Release \
469 -D BUILD_WERROR=ON \
470 -D USE_MASM=OFF \
471 -G Ninja
472 - run: cmake --build build
473 - run: cmake --install build --prefix /tmp