feat(P01): check_leadership_deck.sh smoke test (REQ-372.8 a-f, on-demand)
---ci--- project: acdl phase: 1 milestone: v1.30 status: execute wave: 3 persona: ci-cli-engineer ---/ci---
This commit is contained in:
Executable
+98
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env bash
|
||||
# Nova Leadership Deck smoke test (REQ-372.8).
|
||||
#
|
||||
# Runnable on demand from the repo root. NOT a CI gate (single-shot
|
||||
# artifact per REQ-372.8 / D-241). Asserts:
|
||||
# (a) source markdown exists
|
||||
# (b) slide count = 7
|
||||
# (c) per-slide speaker-note word counts in band
|
||||
# (1/2/4/6: 150-300; 3/5: 250-400; 7: 200-300)
|
||||
# (d) footer string present in source
|
||||
# (e) only S&P hex colors (#D6002A, #1B1B1B, #FFFFFF, #F0F0F0)
|
||||
# (f) rendered PPTX file exists
|
||||
#
|
||||
# Usage: bash scripts/check_leadership_deck.sh
|
||||
# Returns: 0 on pass, 1 on fail.
|
||||
set -euo pipefail
|
||||
|
||||
SRC="docs/presentations/nova-leadership-deck-marp.md"
|
||||
PPTX="docs/presentations/nova-leadership-deck.pptx"
|
||||
FOOTER='Nova Platform - Infrastructure & Operations'
|
||||
ALLOWED_COLORS='#D6002A #1B1B1B #FFFFFF #F0F0F0'
|
||||
|
||||
fail() { echo "FAIL: $1" >&2; exit 1; }
|
||||
ok() { echo "PASS: $1"; }
|
||||
|
||||
# (a) source exists
|
||||
[ -f "$SRC" ] || fail "(a) source not found: $SRC"
|
||||
ok "(a) source exists: $SRC"
|
||||
|
||||
# (b) slide count = 7
|
||||
# Strip frontmatter (first --- ... --- block, which may follow a header
|
||||
# HTML comment), then count --- separators + 1.
|
||||
SLIDE_COUNT=$(awk '
|
||||
!started && /^---[[:space:]]*$/ { started=1; next }
|
||||
started && !infm_done && /^---[[:space:]]*$/ { infm_done=1; next }
|
||||
infm_done && /^---[[:space:]]*$/ { count++ }
|
||||
END { print count + 1 }
|
||||
' "$SRC")
|
||||
[ "$SLIDE_COUNT" -eq 7 ] || fail "(b) slide count=$SLIDE_COUNT (expected 7)"
|
||||
ok "(b) slide count=7"
|
||||
|
||||
# (c) per-slide speaker-note word counts in band.
|
||||
# Extract per-slide speaker notes (HTML comments) and count words.
|
||||
# Bands: 1/2/4/6 -> 150-300; 3/5 -> 250-400; 7 -> 200-300.
|
||||
python3 - "$SRC" << 'PYEOF' || fail "(c) speaker-note word count out of band"
|
||||
import re, sys
|
||||
md = open(sys.argv[1]).read()
|
||||
lines = md.splitlines()
|
||||
# find frontmatter end
|
||||
fm_begin = None
|
||||
for i, l in enumerate(lines):
|
||||
if l.strip() == "---":
|
||||
fm_begin = i
|
||||
break
|
||||
fm_end = None
|
||||
for i in range(fm_begin+1, len(lines)):
|
||||
if lines[i].strip() == "---":
|
||||
fm_end = i
|
||||
break
|
||||
body = "\n".join(lines[fm_end+1:])
|
||||
parts = re.split(r"\n---\s*\n", body)
|
||||
slides = [p for p in parts if p.strip()]
|
||||
bands = {1:(150,300), 2:(150,300), 3:(250,400), 4:(150,300), 5:(250,400), 6:(150,300), 7:(200,300)}
|
||||
for idx, slide in enumerate(slides, 1):
|
||||
notes = re.findall(r"<!--\s*(.*?)\s*-->", slide, re.DOTALL)
|
||||
note_text = " ".join(notes)
|
||||
wc = len(note_text.split())
|
||||
lo, hi = bands[idx]
|
||||
if not (lo <= wc <= hi):
|
||||
print(f" slide {idx}: {wc} words (band {lo}-{hi}) FAIL", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
print(f" slide {idx}: {wc} words (band {lo}-{hi}) ok")
|
||||
print("PASS (c) all speaker-note word counts in band")
|
||||
PYEOF
|
||||
ok "(c) speaker-note word counts in band"
|
||||
|
||||
# (d) footer string present in source
|
||||
grep -qF "$FOOTER" "$SRC" || fail "(d) footer string not found in source"
|
||||
ok "(d) footer string present in source"
|
||||
|
||||
# (e) only S&P hex colors in source
|
||||
COLORS=$(grep -oiE '#[0-9A-Fa-f]{6}' "$SRC" | sort -u | tr '\n' ' ' | sed 's/ $//')
|
||||
for c in $COLORS; do
|
||||
found=0
|
||||
for a in $ALLOWED_COLORS; do
|
||||
[ "$c" = "$a" ] && found=1 && break
|
||||
done
|
||||
[ "$found" -eq 1 ] || fail "(e) non-S&P color found: $c (allowed: $ALLOWED_COLORS)"
|
||||
done
|
||||
ok "(e) only S&P theme colors: ${COLORS:-<none>}"
|
||||
|
||||
# (f) PPTX file exists (hard fail per Q-M4)
|
||||
[ -f "$PPTX" ] || fail "(f) PPTX not found: $PPTX (run: python3 scripts/render_pptx.py $SRC --output $PPTX)"
|
||||
ok "(f) PPTX exists: $PPTX"
|
||||
|
||||
echo
|
||||
echo "ALL CHECKS PASSED"
|
||||
exit 0
|
||||
Reference in New Issue
Block a user