feat(gate): check.sh --brief prints a red lane's first error lines only
This commit is contained in:
@@ -1436,7 +1436,8 @@
|
|||||||
"e2e/helpers.ts",
|
"e2e/helpers.ts",
|
||||||
"e2e/nav.spec.ts",
|
"e2e/nav.spec.ts",
|
||||||
"e2e/player.spec.ts",
|
"e2e/player.spec.ts",
|
||||||
"e2e/settings.spec.ts"
|
"e2e/settings.spec.ts",
|
||||||
|
"e2e/speed.measure.ts"
|
||||||
],
|
],
|
||||||
"js configs": ["eslint.config.js", "postcss.config.js"],
|
"js configs": ["eslint.config.js", "postcss.config.js"],
|
||||||
"lib tests": [
|
"lib tests": [
|
||||||
@@ -2309,16 +2310,40 @@
|
|||||||
"scripts/check.sh": [
|
"scripts/check.sh": [
|
||||||
"set -u",
|
"set -u",
|
||||||
"cd \"$(dirname \"$0\")/..\" || exit 2",
|
"cd \"$(dirname \"$0\")/..\" || exit 2",
|
||||||
"mode=\"${1:-all}\"",
|
"mode=all",
|
||||||
"case \"$mode\" in all | lint) ;; *) echo \"usage: scripts/check.sh [lint]\" >&2; exit 2 ;; esac",
|
"brief=0",
|
||||||
|
"for arg in \"$@\"; do",
|
||||||
|
" case \"$arg\" in",
|
||||||
|
" all | lint) mode=\"$arg\" ;;",
|
||||||
|
" --brief) brief=1 ;;",
|
||||||
|
" esac",
|
||||||
|
"done",
|
||||||
"export MSYS_NO_PATHCONV=1 # Git Bash: do not rewrite the in-container paths below",
|
"export MSYS_NO_PATHCONV=1 # Git Bash: do not rewrite the in-container paths below",
|
||||||
"TESTCOMPOSE=backend/docker-compose.test.yml",
|
"TESTCOMPOSE=backend/docker-compose.test.yml",
|
||||||
"failed=()",
|
"failed=()",
|
||||||
"lane() { # lane <name> <command…> — run it, remember a failure, never stop",
|
"lane() { # lane <name> <command…> — run it, remember a failure, never stop",
|
||||||
" local name=\"$1\"",
|
" local name=\"$1\"",
|
||||||
" shift",
|
" shift",
|
||||||
" echo \">> $name…\"",
|
" if [ \"$brief\" = 0 ]; then",
|
||||||
" \"$@\" || failed+=(\"$name\")",
|
" echo \">> $name…\"",
|
||||||
|
" \"$@\" || failed+=(\"$name\")",
|
||||||
|
" return 0",
|
||||||
|
" fi",
|
||||||
|
" local out",
|
||||||
|
" out=\"$(mktemp)\"",
|
||||||
|
" if \"$@\" >\"$out\" 2>&1; then",
|
||||||
|
" echo \">> $name: ok\"",
|
||||||
|
" else",
|
||||||
|
" failed+=(\"$name\")",
|
||||||
|
" echo \">> $name: FAILED\"",
|
||||||
|
" brief_excerpt \"$out\"",
|
||||||
|
" fi",
|
||||||
|
" rm -f \"$out\"",
|
||||||
|
"}",
|
||||||
|
"brief_excerpt() {",
|
||||||
|
" local hits",
|
||||||
|
" hits=\"$(grep -E -i -A 2 -m 20 'error|fail|✗|×|warn|would reformat|unused|vulnerab|found [0-9]' \"$1\")\"",
|
||||||
|
" if [ -n \"$hits\" ]; then printf '%s\\n' \"$hits\"; else tail -n 20 \"$1\"; fi",
|
||||||
"}",
|
"}",
|
||||||
"ruff_pinned() {",
|
"ruff_pinned() {",
|
||||||
" local pin host",
|
" local pin host",
|
||||||
|
|||||||
+34
-4
@@ -7,6 +7,8 @@
|
|||||||
#
|
#
|
||||||
# bash scripts/check.sh every lane (what a release requires, before e2e and the CVE scan)
|
# bash scripts/check.sh every lane (what a release requires, before e2e and the CVE scan)
|
||||||
# bash scripts/check.sh lint the static lanes only: no tests, no build, no audits
|
# bash scripts/check.sh lint the static lanes only: no tests, no build, no audits
|
||||||
|
# … --brief (either mode) a lane's output only when it fails, and only its first
|
||||||
|
# error lines — for an agent, whose context the full log would flood
|
||||||
#
|
#
|
||||||
# Each lane runs even when an earlier one failed, and the summary names every red one: a gate that
|
# Each lane runs even when an earlier one failed, and the summary names every red one: a gate that
|
||||||
# stops at the first failure hides the second until the first is fixed. The backend lanes run in the
|
# stops at the first failure hides the second until the first is fixed. The backend lanes run in the
|
||||||
@@ -14,8 +16,15 @@
|
|||||||
# type checker or auditor without the real packages reports nonsense.
|
# type checker or auditor without the real packages reports nonsense.
|
||||||
set -u
|
set -u
|
||||||
cd "$(dirname "$0")/.." || exit 2
|
cd "$(dirname "$0")/.." || exit 2
|
||||||
mode="${1:-all}"
|
mode=all
|
||||||
case "$mode" in all | lint) ;; *) echo "usage: scripts/check.sh [lint]" >&2; exit 2 ;; esac
|
brief=0
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
all | lint) mode="$arg" ;;
|
||||||
|
--brief) brief=1 ;;
|
||||||
|
*) echo "usage: scripts/check.sh [lint] [--brief]" >&2; exit 2 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
export MSYS_NO_PATHCONV=1 # Git Bash: do not rewrite the in-container paths below
|
export MSYS_NO_PATHCONV=1 # Git Bash: do not rewrite the in-container paths below
|
||||||
TESTCOMPOSE=backend/docker-compose.test.yml
|
TESTCOMPOSE=backend/docker-compose.test.yml
|
||||||
@@ -23,8 +32,29 @@ failed=()
|
|||||||
lane() { # lane <name> <command…> — run it, remember a failure, never stop
|
lane() { # lane <name> <command…> — run it, remember a failure, never stop
|
||||||
local name="$1"
|
local name="$1"
|
||||||
shift
|
shift
|
||||||
echo ">> $name…"
|
if [ "$brief" = 0 ]; then
|
||||||
"$@" || failed+=("$name")
|
echo ">> $name…"
|
||||||
|
"$@" || failed+=("$name")
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
local out
|
||||||
|
out="$(mktemp)"
|
||||||
|
if "$@" >"$out" 2>&1; then
|
||||||
|
echo ">> $name: ok"
|
||||||
|
else
|
||||||
|
failed+=("$name")
|
||||||
|
echo ">> $name: FAILED"
|
||||||
|
brief_excerpt "$out"
|
||||||
|
fi
|
||||||
|
rm -f "$out"
|
||||||
|
}
|
||||||
|
# The lines that say what broke: the first 20 error-looking ones, each with the two lines after it
|
||||||
|
# (knip names the file on the line after "Unused files"); a log with none of them (a tool that
|
||||||
|
# words its failures some other way) shows its tail instead, which is where a summary sits.
|
||||||
|
brief_excerpt() {
|
||||||
|
local hits
|
||||||
|
hits="$(grep -E -i -A 2 -m 20 'error|fail|✗|×|warn|would reformat|unused|vulnerab|found [0-9]' "$1")"
|
||||||
|
if [ -n "$hits" ]; then printf '%s\n' "$hits"; else tail -n 20 "$1"; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- static lanes ------------------------------------------------------------------------------------
|
# --- static lanes ------------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user