Skip to content

Commit 42e9ca5

Browse files
committed
ci: the offscreen example's shaders are looked for in the outDir resolution.json records
.github/tools/out_dir.sh prints the root package's outDir of the newest build; the Linux, macOS and Windows graphics steps read the spirv headers there instead of naming target/.build-mcpp/out.
1 parent 0f9c782 commit 42e9ca5

4 files changed

Lines changed: 18 additions & 3 deletions

File tree

‎.github/tools/out_dir.sh‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
# Prints where `mcpp::out_dir()` pointed for the root package in the newest
3+
# build of the package in the current directory: its `outDir` in
4+
# resolution.json. Each configuration has its own output directory, so a check
5+
# reads it instead of naming target/.build-mcpp/out.
6+
r=$(ls -t target/*/*/resolution.json 2>/dev/null | head -1)
7+
[ -n "$r" ] || { echo "out_dir.sh: no resolution.json under target/" >&2; exit 1; }
8+
py=$(command -v python3 || command -v python)
9+
d=$("$py" -c 'import json, sys
10+
for p in json.load(open(sys.argv[1])).get("graph", {}).get("packages", []):
11+
if p.get("root"):
12+
print(p.get("outDir", ""))
13+
break' "$r")
14+
[ -n "$d" ] || { echo "out_dir.sh: $r records no outDir for the root package" >&2; exit 1; }
15+
echo "$d"

‎.github/workflows/ci-linux.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ jobs:
349349
# THE SHADERS ARE THE FIRST ASSERTION, and both of them: a rule that
350350
# compiled only the first source would leave the second header absent
351351
# and everything after this would still pass.
352+
d="$(sh "$GITHUB_WORKSPACE/.github/tools/out_dir.sh")/spirv"
352353
for f in triangle_vert triangle_frag; do
353-
d="target/.build-mcpp/out/spirv"
354354
test -f "$d/$f.h" || { echo "missing $d/$f.h"; exit 1; }
355355
# Either file: which of the two carries the words is a property of
356356
# the shader compiler the rule chose, not of the shader. See the

‎.github/workflows/ci-macos.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ jobs:
374374
# a neighbouring step happened to select makes this step's subject
375375
# depend on step order, which is not a property anybody reads.
376376
"/tmp/mcpp-fresh" build --toolchain "llvm@${MCPP_LLVM_VER}"
377+
d="$(sh "$GITHUB_WORKSPACE/.github/tools/out_dir.sh")/spirv"
377378
for f in triangle_vert triangle_frag; do
378-
d="target/.build-mcpp/out/spirv"
379379
test -f "$d/$f.h" || { echo "missing $d/$f.h"; exit 1; }
380380
# THE MAGIC IS NOT ALWAYS IN THE HEADER, AND THAT IS THE POINT OF
381381
# THIS JOB. The rule chooses the shader compiler this platform

‎.github/workflows/ci-windows.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,8 @@ jobs:
432432
# a neighbouring step happened to select makes this step's subject
433433
# depend on step order, which is not a property anybody reads.
434434
"$MCPP_SELF" build --toolchain "llvm@23.1.3"
435+
d="$(sh "$GITHUB_WORKSPACE/.github/tools/out_dir.sh")/spirv"
435436
for f in triangle_vert triangle_frag; do
436-
d="target/.build-mcpp/out/spirv"
437437
test -f "$d/$f.h" || { echo "missing $d/$f.h"; exit 1; }
438438
# THE MAGIC IS NOT ALWAYS IN THE HEADER, AND THAT IS THE POINT OF
439439
# THIS JOB. The rule chooses the shader compiler this platform

0 commit comments

Comments
 (0)