-
Notifications
You must be signed in to change notification settings - Fork 472
/
.gitlab-ci.yml
255 lines (239 loc) · 9.23 KB
/
.gitlab-ci.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
# Copyright 2018-2024 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
# Gitlab CI file for vulkan spec and header generation
# All stages use the same Docker image, so there are no prerequisites
# Refer to the container by its SHA instead of the name, to prevent
# caching problems when updating the image.
# image: khronosgroup/docker-images:asciidoctor-spec.20240727
# There are no 'before_script' tags for most stages, because all
# prerequisites are in the default image.
image: khronosgroup/docker-images@sha256:089687083ceb36483a3917389e4278718ab19c594099634f5dd80e22540c960f
# Specify which gitlab runner to use
default:
tags:
- khrmedium
# Verify repository license compliance
license-check:
stage: build
script:
- reuse lint
allow_failure: false
# Run consistency checks on the spec and XML sources
# Separate from the generate step to set allow_failure: false
consistency-check:
stage: build
script:
# Internal self-test of the check_spec_links script
- ( cd scripts && pytest test*.py )
- mkdir -p gen/out/checks
# Generate a summary of problems for CI logs (if any)
# Override CHECK_XREFS to avoid building a redundant HTML target at this stage
- scripts/check_spec_links.py --html=gen/out/checks/problems.html > /dev/null || true
- make CHECK_XREFS= allchecks
allow_failure: false
# Consistency check for extension development branches
# First verify that SPEC_VERSION >= 1
# Then verify that core + extension spec builds for extension development branches
# This only runs on merge requests where CI_COMMIT_BRANCH is defined, and is
# a valid extension name, or is mapped to one in an exception list in
# scripts/testSpecVersion.py
spec_extension_branch_check:
stage: build
script:
- extension=`scripts/testSpecVersion.py -canonicalize -branch "$CI_COMMIT_BRANCH"`
# $extension will be empty if $CI_COMMIT_BRANCH is not a valid extension name
- test -z "$extension" || scripts/testSpecVersion.py -branch $extension
- test -z "$extension" || ./makeSpec -clean -spec core -extension $extension html
allow_failure: true
# Build a test spec and check against expectation, to make sure the spec toolchain works as expected
spec-toolchain:
stage: build
script:
- ./testBuild
# Build the vulkan specification and generate any associated files (such as vulkan.h)
spec-generate:
stage: build
script:
- NODE_PATH="/usr/lib/node_modules"
- export NODE_PATH
# Validate the XML before building anything using it
- make -C xml validate
# Build the core-only spec, to catch some incorrect ifdef errors
- ./makeSpec -clean -spec core -genpath gencore QUIET= -j${nproc} -Otarget html manhtmlpages
# Build the HTML/chunked spec and other common targets.
# The spec, refpages, and auxiliary documents are built first and the
# build log checked for asciidoctor warnings that cannot be made into
# fatal errors.
- ./makeSpec -clean -spec all QUIET= -j${nproc} -Otarget html manhtmlpages styleguide registry |& tee ERRS
- |+
if fgrep -q 'WARNING: skipping reference to missing attribute:' ERRS
then
echo 'Found missing (undefined) asciidoctor attributes.'
echo 'These are probably from commonvalidity includes where attributes are not defined.'
echo 'If these are reported from building a refpage, edit the corresponding part of'
echo 'the specification source to fix the problem.'
echo '----'
fgrep -B 1 'WARNING: skipping reference to missing attribute:' ERRS
false
else
true
fi
# Build the rest of the targets, without cleaning the output directory
- ./makeSpec -spec all QUIET= -j${nproc} -Otarget chunked validusage
# Check consistency of internal xrefs and anchors in the HTML output
- make check-xrefs
# Build headers, for use by all later stages
- make -C xml install codec_headers test vtest
artifacts:
when: always
paths:
- src/
- gen/
- gencore/
expire_in: 1 week
# Build the vulkan sc specification and generate any associated files (such as vulkan_sc_core.h)
vksc-generate:
stage: build
script:
- NODE_PATH="/usr/lib/node_modules"
- export NODE_PATH
- VULKAN_API="vulkansc"
- export VULKAN_API
# Build the actual spec (both chunked and single-page HTML), and other common targets
- ./makeSpec -clean -spec all -version sc1.0 -genpath genvksc QUIET= -j${nproc} -Otarget manhtmlpages validusage styleguide registry chunked html
# Check consistency of internal xrefs and anchors in the output, now
# that an HTML output is available
#- make check-xrefs
# Build headers, for use by all later stages
- ( cd xml && make GENERATED=../genvksc validate install test )
artifacts:
when: always
paths:
- genvksc/
expire_in: 1 week
allow_failure: true
# Generate the vulkan C++ header (vulkan.hpp)
hpp-generate:
stage: build
before_script:
- SPEC_DIR="${PWD}"
- cd /tmp
- rm -rf Vulkan-Hpp
- git clone https://github.com/KhronosGroup/Vulkan-Hpp.git
- cd Vulkan-Hpp
- git submodule update --init --recursive -- tinyxml2
- rm -rf Vulkan-Docs
- cp -r "${SPEC_DIR}" Vulkan-Docs
# Copy Vulkan C headers into subdir copy used by Vulkan-Hpp
- cp -p ${SPEC_DIR}/include/vulkan/*.h Vulkan-Docs/include/vulkan/
script:
- cd /tmp/Vulkan-Hpp
- cmake -H. -Bbuild
- make -C build
- cd build
- ./VulkanHppGenerator -f "${SPEC_DIR}"/xml/vk.xml
after_script:
- mkdir -p Vulkan-Hpp/vulkan/
- cp /tmp/Vulkan-Hpp/vulkan/*.hpp Vulkan-Hpp/vulkan/
artifacts:
paths:
- Vulkan-Hpp/vulkan/
expire_in: 1 week
allow_failure: true
# Regenerate Rust bindings (Ash crate)
ash-generate:
image: khronosgroup/docker-images@sha256:cf554c9cf5d0322e022f0be32efad9bff44ada4b32653bfdc8033cba22972fa2
stage: build
needs:
- spec-generate # For the full include/ directory
cache: # Generator has lots of dependencies that take a while to download/compile
key: cargo-ash-generator
paths:
- cargo-cache
- ash-target
before_script:
- SPEC_DIR="${PWD}"
- rm -rf ash
- git clone https://github.com/ash-rs/ash
- pushd ash
# Piece together minimal Vulkan-Headers - Ash only needs headers and vk.xml
- rm -rf generator/Vulkan-Headers/* # Should already be empty, just in case
- ln -s ${SPEC_DIR}/gen/include generator/Vulkan-Headers/ # Complete headers come from spec-generate
- ln -s ${SPEC_DIR}/xml generator/Vulkan-Headers/registry # vk.xml sits in the root of this spec repo
# Move to root directory to be picked up by `cache` step
- export CARGO_HOME="${SPEC_DIR}/cargo-cache"
- export CARGO_TARGET_DIR="${SPEC_DIR}/ash-target"
script:
- cargo run -p generator
- cargo fmt --all
after_script:
# Make the folder a single level deep
- mv ash/ash ash-crate
- rm -rf ash/
- mv ash-crate ash
artifacts:
paths:
- ash
expire_in: 1 week
allow_failure: true
# Run the CTS Vulkan framework tests, to make sure XML changes will not
# cause problems there.
cts-framework-tests:
stage: build
script:
# Clone the CTS GitHub repository.
# Use sparse / shallow clone since the repo is enormous and mostly not needed for these tests
- git clone --sparse --depth 1 --single-branch --branch main https://github.com/KhronosGroup/VK-GL-CTS.git
- cd VK-GL-CTS
# Add sparse checkout paths for required directories
- git sparse-checkout add scripts external/vulkancts/framework external/vulkancts/scripts
# Link the spec project into CTS hierarchy, instead of cloning it
- mkdir external/vulkan-docs
- ln -s `cd .. ; pwd` external/vulkan-docs/src
# Run the Vulkan-specific tests (from scripts/check_build_sanity.py) # codespell:allow sanity
- python3 external/vulkancts/scripts/gen_framework.py
- python3 external/vulkancts/scripts/gen_framework_c.py
- python3 external/vulkancts/scripts/gen_framework.py --api SC
- python3 external/vulkancts/scripts/gen_framework_c.py --api SC
allow_failure: true
# Compile a simple test program that uses vulkan.h
# The fake platform headers in tests/ allow compiling with all Vulkan
# platforms at once.
h-compile:
stage: test
needs:
- spec-generate
script:
- gcc -c -std=c11 -Igen/include -Itests -Wall -Wextra -Werror tests/htest.c
- clang -c -std=c11 -Igen/include -Itests -Wall -Wextra -Werror tests/htest.c
# Compile a simple test program that uses vulkan.hpp
hpp-compile:
stage: test
needs:
- spec-generate
- hpp-generate
script:
- g++ -c -std=c++11 -Igen/include -IVulkan-Hpp -Wall -Wextra -Werror tests/hpptest.cpp
- clang++ -c -std=c++11 -Igen/include -IVulkan-Hpp -Wall -Wextra -Werror tests/hpptest.cpp
allow_failure: true
# Build-test Rust bindings (Ash crate)
ash-compile:
image: khronosgroup/docker-images@sha256:cf554c9cf5d0322e022f0be32efad9bff44ada4b32653bfdc8033cba22972fa2
stage: test
needs:
- ash-generate
cache:
key:
files:
- ash/Cargo.toml
paths:
- cargo-cache
- ash-target
before_script:
- export CARGO_HOME="${SPEC_DIR}/cargo-cache"
- export CARGO_TARGET_DIR="${SPEC_DIR}/ash-target"
script:
- cd ash
# Build-test the ash crate
- cargo clippy --all --all-targets
allow_failure: true