Skip to content

Commit 161cda0

Browse files
ci: assert staged binaries match versions.json, not a count
The check asserted 'at least 13'. A floor stops asserting anything the moment the real number grows: add a fourteenth component and it keeps passing, so the check quietly becomes decoration. A hardcoded '-eq 13' fixes that but still only sees the count, and 13 is a magic number with no relationship to where components are actually declared. Compares the staged names against the component keys in versions.json instead. Adding, removing, or renaming a component now fails until the build script and the manifest agree, and the failure names which side is missing what rather than reporting a number. Signed-off-by: Terve <ntervalon@nvidia.com>
1 parent 77ac75f commit 161cda0

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,27 @@ jobs:
145145
shell: cmd
146146
run: build.bat
147147

148-
# Catches a script that exits 0 having staged nothing. The binaries
149-
# are not executed: several are servers that would ignore an
150-
# unrecognized flag and start listening.
151-
- name: Check staged binaries
148+
# Compares the staged set against versions.json rather than a count.
149+
# A floor like `-ge 13` passes quietly the moment the real number
150+
# grows, so it stops asserting anything; and a hardcoded `-eq 13`
151+
# only catches the count, not a rename. Comparing names means
152+
# adding, removing, or renaming a component fails here until the
153+
# build script and the manifest agree again.
154+
#
155+
# The binaries are not executed to check them: several are servers
156+
# that would ignore an unrecognized flag and start listening.
157+
- name: Check staged binaries match versions.json
152158
working-directory: services
153159
shell: bash
154160
run: |
155-
ls -l build/bin
156-
count=$(ls build/bin | wc -l)
157-
echo "staged $count binaries"
158-
test "$count" -ge 13
161+
expected=$(jq -r '.components | keys[]' versions.json | sort)
162+
staged=$(ls build/bin | sed 's/\.exe$//' | sort)
163+
if [ "$expected" != "$staged" ]; then
164+
echo "::error::build/bin does not match versions.json components"
165+
echo "declared but not staged (build script missing a component?):"
166+
comm -23 <(echo "$expected") <(echo "$staged")
167+
echo "staged but not declared (versions.json missing a component?):"
168+
comm -13 <(echo "$expected") <(echo "$staged")
169+
exit 1
170+
fi
171+
echo "all $(echo "$expected" | wc -l | tr -d ' ') declared components staged"

0 commit comments

Comments
 (0)