-
Notifications
You must be signed in to change notification settings - Fork 468
291 lines (264 loc) · 10.9 KB
/
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# Copyright 2021-2024 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
# GitHub CI file for vulkan spec and header generation
# See .gitlab-ci.yml for non-Actions comments and step dependencies.
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or manual dispatch
push:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# When a pull request is opened from a local branch or fork
pull_request:
jobs:
license-check:
name: Verify repository license compliance
runs-on: ubuntu-latest
# We now refer to the container by its SHA instead of the name, to prevent
# caching problems when updating the image.
# container: khronosgroup/docker-images:asciidoctor-spec.20240726
container: khronosgroup/docker-images@sha256:089687083ceb36483a3917389e4278718ab19c594099634f5dd80e22540c960f
steps:
- uses: actions/checkout@v4
- name: REUSE license checker
run: reuse lint
terminology-check:
name: Run various checker scripts on the spec and XML sources
runs-on: ubuntu-latest
container: khronosgroup/docker-images@sha256:089687083ceb36483a3917389e4278718ab19c594099634f5dd80e22540c960f
steps:
- uses: actions/checkout@v4
- name: Internal self-test of the check_spec_links script
run: pytest test*.py
working-directory: scripts
- name: Generate a summary of problems for CI logs (if any)
run: |
mkdir -p gen/out/checks
scripts/check_spec_links.py --html=gen/out/checks/problems.html > /dev/null || true
make CHECK_XREFS= allchecks
spec-toolchain:
name: Build a test spec and check against expectation, to make sure the spec toolchain works as expected
runs-on: ubuntu-latest
container: khronosgroup/docker-images@sha256:089687083ceb36483a3917389e4278718ab19c594099634f5dd80e22540c960f
steps:
- uses: actions/checkout@v4
- run: ./testBuild
spec-core:
name: Build the core-only spec, to try and catch ifdef errors in extension markup
runs-on: ubuntu-latest
container: khronosgroup/docker-images@sha256:089687083ceb36483a3917389e4278718ab19c594099634f5dd80e22540c960f
steps:
- uses: actions/checkout@v4
- run: ./makeSpec -clean -spec core -genpath gencore QUIET= -j${nproc} -Otarget chunked html
spec-generate:
name: Build the vulkan specification and generate any associated files (such as vulkan.h)
runs-on: ubuntu-latest
container: khronosgroup/docker-images@sha256:089687083ceb36483a3917389e4278718ab19c594099634f5dd80e22540c960f
steps:
- uses: actions/checkout@v4
- name: Build the actual spec (both chunked and single-page HTML), and other common targets
run: ./makeSpec -clean -spec all QUIET= -j${nproc} -Otarget manhtmlpages validusage styleguide registry chunked html
- name: Check consistency of internal xrefs and anchors in the output, now that an HTML output is available
run: make check-xrefs
- name: Build headers, for use by all later stages
run: make validate install test
working-directory: xml
- name: Package generated spec
# https://github.com/actions/upload-artifact#limitations
# upload-artifact would upload all of almost 10k files individually
# to GitHub, taking an inordinate amount of time. Tar it to upload
# just one large file:
run: tar -cvf spec-outputs.tar gen/
- name: Archive generated spec
uses: actions/upload-artifact@v4
with:
name: spec-outputs
path: spec-outputs.tar
hpp-generate:
name: Generate the vulkan C++ header (vulkan.hpp)
runs-on: ubuntu-latest
needs: spec-generate
continue-on-error: true
steps:
- uses: actions/checkout@v4
# Generate the vulkan C++ header (vulkan.hpp)
# Failure (should be) allowed, for now
- name: Download generated spec
uses: actions/download-artifact@v4
with:
name: spec-outputs
- name: Unpack generated spec
run: tar -xvf spec-outputs.tar
- run: |
SPEC_DIR="${PWD}"
# Unfortunately, asciidoctor-pdf gets pathname-specific errors
# building under the usual $GITHUB_WORKSPACE (/__w). As a workaround,
# generate the outputs in /tmp.
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
ln -s "${SPEC_DIR}" 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/
echo "Files in Vulkan-Docs:"
find Vulkan-Docs -type f
# cd /tmp/Vulkan-Hpp
cmake -H. -Bbuild
make -C build
cd build
./VulkanHppGenerator -f "${SPEC_DIR}"/xml/vk.xml
cp /tmp/Vulkan-Hpp/vulkan/*.hpp ${SPEC_DIR}/gen/include/vulkan/
- name: Upload generated hpp
uses: actions/upload-artifact@v4
with:
name: hpp-outputs
path: gen/include/
ash-generate:
name: Generate Rust bindings (Ash crate)
runs-on: ubuntu-latest
needs: spec-generate
continue-on-error: true
env:
# Cached folder outside of git repo
CARGO_TARGET_DIR: ${{ github.workspace }}/ash-target
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: ash-rs/ash
path: ash
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
ash-target/
key: ${{ runner.os }}-cargo-ash-generator-${{ hashFiles('**/Cargo.toml', '.github/workflows/CI.yml') }}
restore-keys: |
${{ runner.os }}-cargo-ash-generator-
- name: Download generated spec
uses: actions/download-artifact@v4
with:
name: spec-outputs
- name: Unpack generated spec
run: tar -xvf spec-outputs.tar
- name: Prepare environment
working-directory: ash
run: |
# 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 ${{ github.workspace }}/gen/include generator/Vulkan-Headers/ # Complete headers come from spec-generate
ln -s ${{ github.workspace }}/xml generator/Vulkan-Headers/registry # vk.xml sits in the root of this spec repo
- name: Generate Ash crate
working-directory: ash
run: |
cargo run -p generator
cargo fmt --all
- name: Package generated Ash crate
# https://github.com/actions/upload-artifact#limitations, see above
run: tar -cvf ash-outputs.tar ash/
- name: Upload generated ash
uses: actions/upload-artifact@v4
with:
name: ash-outputs
path: ash-outputs.tar
# Run the CTS Vulkan framework tests, to make sure XML changes will not
# cause problems there.
cts-framework-tests:
name: Run Vulkan CTS framework tests to validate against XML changes
runs-on: ubuntu-latest
container: khronosgroup/docker-images@sha256:089687083ceb36483a3917389e4278718ab19c594099634f5dd80e22540c960f
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Sparse/shallow clone of CTS GitHub repository to pull only relevant parts
run: |
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
- name: Run the Vulkan-specific tests (from scripts/check_build_sanity.py) # codespell:allow sanity
run: |
cd VK-GL-CTS
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
h-compile:
name: Compile a simple test program that uses vulkan.h
runs-on: ubuntu-latest
needs: spec-generate
steps:
- uses: actions/checkout@v4
- name: Download generated files
uses: actions/download-artifact@v4
with:
name: spec-outputs
- name: Unpack generated spec
run: tar -xvf spec-outputs.tar
# Compile a simple test program that uses vulkan.h
# The fake platform headers in tests/ allow compiling with all Vulkan
# platforms at once.
- run: |
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
hpp-compile:
name: Compile a simple test program that uses vulkan.hpp
runs-on: ubuntu-latest
needs: [spec-generate, hpp-generate]
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Download generated spec
uses: actions/download-artifact@v4
with:
name: spec-outputs
- name: Unpack generated spec
run: tar -xvf spec-outputs.tar
- name: Download generated hpp
uses: actions/download-artifact@v4
with:
name: hpp-outputs
path: gen/include/
# Compile a simple test program that uses vulkan.hpp
# Depends on spec-generate and hpp-generate
# Failure (should be) allowed, for now
- run: |
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
ash-compile:
name: Build-test Rust bindings (Ash crate)
runs-on: ubuntu-latest
needs: ash-generate
continue-on-error: true
steps:
- name: Download generated files
uses: actions/download-artifact@v4
with:
name: ash-outputs
- name: Unpack generated Ash crate
run: tar -xvf ash-outputs.tar
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
ash/target/
key: ${{ runner.os }}-cargo-ash-compile-${{ hashFiles('**/Cargo.toml', '.github/workflows/CI.yml') }}
restore-keys: |
${{ runner.os }}-cargo-ash-compile-
- name: Build-test ash crate
working-directory: ash
run: cargo clippy --all --all-targets