Files
lucisv/tools/audit_artifacts.sh
T
lucioandClaude Fable 5 c556a13857
ci / checks (push) Successful in 36s
ci / corpus (push) Successful in 26s
release / build-and-publish (push) Successful in 3m7s
CI: corpus score is a gate, releases audit their artifacts; v0.7.2
The corpus job scores the pinned-rev corpus (cached at
~/.cache/lucisv-corpus on the runner, fetched once on a miss) on every
push and fails below scripts/corpus-baseline (813) or on any
verification error / crash. The release workflow now runs
tools/audit_artifacts.sh before publishing: musl must be fully static,
linux-gnu's glibc ceiling must stay <= 2.28 (RHEL 8), every file must be
the object format its name claims — verified against the 10 real v0.7.1
release binaries. Linux execution under Docker was considered and
declined: no container runtime on the runner. Version 0.7.2 with a
changelog covering this, the printer column fix and the README truth
pass.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-08-26 02:13:04 -07:00

89 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Audit the cross-built release artifacts in a dist directory.
#
# Usage: tools/audit_artifacts.sh [dist-dir]
#
# There is no Linux or Windows machine in the release loop, so the
# non-macOS artifacts are never executed; this automates the audit
# tools/RELEASING.md documented as manual, and the release fails if any
# check does:
# *-linux-musl ELF x86-64, statically linked (zero NEEDED entries)
# *-linux-gnu ELF x86-64, glibc symbol ceiling <= 2.28 (RHEL 8)
# *-windows-gnu.exe PE32+ x86-64
# *-apple-darwin Mach-O 64-bit (arm64 / x86_64 per triple)
#
# Needs the messense x86_64-unknown-linux-gnu toolchain's objdump for the
# ELF checks (the same toolchain the linux-gnu build itself needs).
set -eu
dist=${1:-dist}
objdump=x86_64-unknown-linux-gnu-objdump
glibc_max=2.28
command -v "$objdump" >/dev/null || { echo "no $objdump on PATH" >&2; exit 2; }
[ -d "$dist" ] || { echo "no dist directory at $dist" >&2; exit 2; }
status=0
fail() { echo "FAIL: $*" >&2; status=1; }
checked=0
for f in "$dist"/lucisv-*; do
[ -f "$f" ] || continue
name=$(basename "$f")
case $name in
*.vsix | SHA256SUMS | RELEASE_NOTES.md) continue ;;
esac
kind=$(file -b "$f")
case $name in
*x86_64-unknown-linux-musl)
case $kind in
*ELF*x86-64*) ;;
*) fail "$name: not an x86-64 ELF: $kind" ;;
esac
if "$objdump" -p "$f" | grep -q NEEDED; then
fail "$name: musl build has dynamic dependencies (must be static)"
fi
;;
*x86_64-unknown-linux-gnu)
case $kind in
*ELF*x86-64*) ;;
*) fail "$name: not an x86-64 ELF: $kind" ;;
esac
top=$("$objdump" -T "$f" | grep -o 'GLIBC_[0-9.]*' | sort -Vu | tail -1)
top=${top#GLIBC_}
highest=$(printf '%s\n%s\n' "$top" "$glibc_max" | sort -V | tail -1)
if [ "$highest" != "$glibc_max" ]; then
fail "$name: glibc ceiling $top exceeds $glibc_max (breaks RHEL 8)"
fi
;;
*x86_64-pc-windows-gnu.exe)
case $kind in
*PE32+*x86-64*) ;;
*) fail "$name: not a PE32+ x86-64 executable: $kind" ;;
esac
;;
*aarch64-apple-darwin)
case $kind in
*Mach-O*arm64*) ;;
*) fail "$name: not a Mach-O arm64 binary: $kind" ;;
esac
;;
*x86_64-apple-darwin)
case $kind in
*Mach-O*x86_64*) ;;
*) fail "$name: not a Mach-O x86_64 binary: $kind" ;;
esac
;;
*)
fail "$name: unrecognized artifact name — teach this script about it"
;;
esac
checked=$((checked + 1))
echo "ok: $name"
done
[ "$checked" -gt 0 ] || { echo "no binaries found under $dist" >&2; exit 2; }
echo "audited $checked binaries"
exit $status