Skip to content

Commit 7569b4c

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 50572ed commit 7569b4c

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
@@ -196,10 +196,17 @@ jobs:
196196
# a graph in which one package reaches a dependency by version and
197197
# another by path, so substituting only the root leaves the build
198198
# refusing for a second reason instead of the first.
199-
sed -i 's|^openkal = .*$|openkal = { path = ".spec" }|' mcpp.toml
200-
sed -i 's|^openkal = .*$|openkal = { path = "../../.spec" }|' examples/hello/mcpp.toml
201-
grep -q 'path = ".spec"' mcpp.toml && grep -q 'path = "../../.spec"' examples/hello/mcpp.toml \
202-
|| { echo "::error::the specification was not substituted"; exit 1; }
199+
# ⚠️ NOT `sed -i'. This step runs on macOS and on Windows too, and
200+
# BSD sed requires an argument to -i that GNU sed refuses. A temporary
201+
# file is the spelling that holds on all three.
202+
subst() { # subst <file> <relative-path-to-the-specification>
203+
sed "s|^openkal = .*$|openkal = { path = \"$2\" }|" "$1" > "$1.next"
204+
mv "$1.next" "$1"
205+
grep -q "path = \"$2\"" "$1" \
206+
|| { echo "::error::$1 was not substituted"; exit 1; }
207+
}
208+
subst mcpp.toml .spec
209+
subst examples/hello/mcpp.toml ../../.spec
203210
- name: Install the emulator
204211
run: |
205212
# Both homes: the shim on PATH dispatches against whichever home owns
@@ -497,9 +504,16 @@ jobs:
497504
# a graph in which one package reaches a dependency by version and
498505
# another by path, so substituting only the root leaves the build
499506
# refusing for a second reason instead of the first.
500-
sed -i 's|^openkal = .*$|openkal = { path = ".spec" }|' mcpp.toml
501-
grep -q 'path = ".spec"' mcpp.toml \
502-
|| { echo "::error::the specification was not substituted"; exit 1; }
507+
# ⚠️ NOT `sed -i'. This step runs on macOS and on Windows too, and
508+
# BSD sed requires an argument to -i that GNU sed refuses. A temporary
509+
# file is the spelling that holds on all three.
510+
subst() { # subst <file> <relative-path-to-the-specification>
511+
sed "s|^openkal = .*$|openkal = { path = \"$2\" }|" "$1" > "$1.next"
512+
mv "$1.next" "$1"
513+
grep -q "path = \"$2\"" "$1" \
514+
|| { echo "::error::$1 was not substituted"; exit 1; }
515+
}
516+
subst mcpp.toml .spec
503517
- name: The backend cross-builds
504518
run: |
505519
# ⚠️ TWICE, AND THE FIRST IS ALLOWED TO FAIL — every row of this

0 commit comments

Comments
 (0)