Skip to content

Commit 35a4b30

Browse files
committed
ci: substitute the specification per step, not per job
Measured 2026-08-28 across the eight repositories of this ecosystem while one change spanned all of them: eight jobs in four of them called `mcpp build' at a point where the manifest still named openkal BY VERSION, so a version under review -- which by definition is not published -- failed them with E_NOT_FOUND. The mechanism is not a missing substitution. run-conformance.sh substitutes the manifest and RESTORES IT ON EXIT, correctly; every step after it is back to naming a version. So an audit asking "does this job substitute?" passes the job and misses the steps, which is how the first pass at this found three repositories and not four. These steps are green on main and can only be green there, because there the published version is the one under test. It is not a check that fails, it is a check that cannot run at the only time it would have something to say. The substitution is also portable now: the opensbi and uefi portability jobs run on macOS and Windows, where BSD sed requires an argument to -i that GNU sed refuses.
1 parent 2c9564a commit 35a4b30

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,17 @@ jobs:
191191
# a graph in which one package reaches a dependency by version and
192192
# another by path, so substituting only the root leaves the build
193193
# refusing for a second reason instead of the first.
194-
sed -i 's|^openkal = .*$|openkal = { path = ".spec" }|' mcpp.toml
195-
sed -i 's|^openkal = .*$|openkal = { path = "../../.spec" }|' examples/hello/mcpp.toml
196-
grep -q 'path = ".spec"' mcpp.toml && grep -q 'path = "../../.spec"' examples/hello/mcpp.toml \
197-
|| { echo "::error::the specification was not substituted"; exit 1; }
194+
# ⚠️ NOT `sed -i'. This step runs on macOS and on Windows too, and
195+
# BSD sed requires an argument to -i that GNU sed refuses. A temporary
196+
# file is the spelling that holds on all three.
197+
subst() { # subst <file> <relative-path-to-the-specification>
198+
sed "s|^openkal = .*$|openkal = { path = \"$2\" }|" "$1" > "$1.next"
199+
mv "$1.next" "$1"
200+
grep -q "path = \"$2\"" "$1" \
201+
|| { echo "::error::$1 was not substituted"; exit 1; }
202+
}
203+
subst mcpp.toml .spec
204+
subst examples/hello/mcpp.toml ../../.spec
198205
- name: Install OVMF and qemu
199206
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends ovmf qemu-system-x86
200207

@@ -460,9 +467,16 @@ jobs:
460467
# a graph in which one package reaches a dependency by version and
461468
# another by path, so substituting only the root leaves the build
462469
# refusing for a second reason instead of the first.
463-
sed -i 's|^openkal = .*$|openkal = { path = ".spec" }|' mcpp.toml
464-
grep -q 'path = ".spec"' mcpp.toml \
465-
|| { echo "::error::the specification was not substituted"; exit 1; }
470+
# ⚠️ NOT `sed -i'. This step runs on macOS and on Windows too, and
471+
# BSD sed requires an argument to -i that GNU sed refuses. A temporary
472+
# file is the spelling that holds on all three.
473+
subst() { # subst <file> <relative-path-to-the-specification>
474+
sed "s|^openkal = .*$|openkal = { path = \"$2\" }|" "$1" > "$1.next"
475+
mv "$1.next" "$1"
476+
grep -q "path = \"$2\"" "$1" \
477+
|| { echo "::error::$1 was not substituted"; exit 1; }
478+
}
479+
subst mcpp.toml .spec
466480
- name: The EFI application cross-builds
467481
run: |
468482
# ⚠️ TWICE, AND THE FIRST IS ALLOWED TO FAIL — every row of this

0 commit comments

Comments
 (0)