Files
LLeMbas-CLI/scripts/ci.sh
T
HomerandClaude Fable 5.2 89ade2ad5b
ci / check (push) Canceled after 0s
scripts/hygiene.sh: nothing private in the tracked files, checked in CI
The same check the other LLeMbas repositories run: private domains, .lan
names, container numbers, private address ranges, machine names. Three
lines are allowed, each with its reason in the script: the public forge
the release workflow republishes from, a theme's former name read from old
configurations, and the made-up private hosts the web tool's test needs
(renamed to made-up ones). Wired into scripts/ci.sh as its first step.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-13 09:22:28 +00:00

75 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# The gate every change passes, here or on a runner: types, tests, the compiled binary in a PTY,
# the shell scripts, and the history for secrets. Fetches the tested Bun when there is none.
set -euo pipefail
cd "$(dirname "$0")/.."
step() { printf '\n== %s ==\n' "$*"; }
if ! command -v bun >/dev/null 2>&1; then
if [ -x "$HOME/.bun/bin/bun" ]; then
PATH="$HOME/.bun/bin:$PATH"
else
# The version install.sh fetches, checked against the release's own SHA256SUMS.
version="$(sed -n 's/^BUN_VERSION=//p' install.sh)"
case "$(uname -m)" in
x86_64) arch=x64; grep -qw avx2 /proc/cpuinfo 2>/dev/null || arch=x64-baseline ;;
aarch64 | arm64) arch=aarch64 ;;
*) echo "ci.sh: no Bun for $(uname -m)" >&2; exit 1 ;;
esac
step "Bun $version (bun-linux-$arch)"
dir="${RUNNER_TEMP:-$(mktemp -d)}/bun-$version"
mkdir -p "$dir"
base="https://github.com/oven-sh/bun/releases/download/bun-v$version"
curl -fsSL -o "$dir/bun.zip" "$base/bun-linux-$arch.zip"
curl -fsSL -o "$dir/SHASUMS256.txt" "$base/SHASUMS256.txt"
# The SHA-256 install.sh pins for this version, not the list downloaded beside the zip.
want="$(sed -n "s/^BUN_SHA256_$(echo "$arch" | tr 'a-z-' 'A-Z_')=//p" install.sh)"
[ -n "$want" ] && (cd "$dir" && echo "$want bun.zip" | sha256sum -c --quiet -)
unzip -q -o "$dir/bun.zip" -d "$dir"
PATH="$dir/bun-linux-$arch:$PATH"
fi
fi
bun --version
# The repository is public: nothing private in its tracked files (scripts/hygiene.sh).
step "hygiene"
scripts/hygiene.sh
step "dependencies"
bun install --frozen-lockfile
step "types"
bun x tsc --noEmit # `bun x`: the release zip CI fetches has no bunx link
step "tests"
bun test --timeout 20000
step "the compiled binary (smoke)"
bun run smoke
step "licences of what the binary contains"
bun run licenses --check
# On a CI runner (CI set) a missing linter or scanner fails the run; by hand, it is said and skipped.
missing() {
if [ -n "${CI:-}" ]; then echo "ci.sh: $1 is not installed on this runner" >&2; exit 1; fi
echo "(no $1 here: $2)"
}
if command -v shellcheck >/dev/null 2>&1; then
step "shell scripts"
shellcheck install.sh get.sh scripts/*.sh
else
missing shellcheck "the shell scripts were not linted"
fi
if command -v gitleaks >/dev/null 2>&1; then
step "secrets in the history"
gitleaks detect --source . --log-opts=--all --redact --no-banner
else
missing gitleaks "the history was not scanned"
fi
step "all passed"