Files
admin fe9f84b7c1 refactor(skill): 改为依赖已发布的 sspf v0.4.0,删除自研平台、迁入示例业务包
- 平台改由 sspf 门面提供(workspace 锁 git tag v0.4.0),应用瘦成 ~500 行薄壳
- 删除 src/backend/src/platform(17 文件)、routes.rs、bootstrap.rs、db/schema.sql、7 个旧集成测试
- 迁入 4 个示例业务包 packs/{demo,shop,books,asset},依赖从 sspf-sdk 改门面 sspf
- 新增 check-scaffold.py(SC1-SC6 + 反自证 6/6)、重写 pack-sync.py、新增 new-pack 与 verify.sh
- 删除测「本仓平台实现」的四把静态闸门(platform 搬走后无测量对象,留着即假绿)
- 契约补入 asset:MENU_TREE 9 菜单、ENDPOINT +3、FACE A=28
- 前端 dist 入库(后端直接托管,免 npm build)
- 验收:check-scaffold 6/6 + 自证 6/6;perm-smoke 32/32;perm-smoke-jnpf 18/18;verify.sh 7/7
2026-11-04 22:36:13 +08:00

99 lines
3.2 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# verify.sh —— 一键验收(本仓只有业务,所以判据也只剩两类)
#
# 用法:
# bash scripts/verify.sh # 全量:静态 + cargo test + 两把运行时尺子
# bash scripts/verify.sh --fast # 只静态 + cargo test(不起服务)
#
# 退出码:0 = 全绿 / 1 = 有步骤失败
#
# 🔴 **为什么没有「平台对不对」的判据**:平台在已发布的 `sspf` 包里,
# 它自己的 14 步验收在**平台仓**跑。本仓只证明两件事:
# ① 本仓没有把平台抄回来(`check-scaffold.py`,6 条 + 反自证 6/6);
# ② 业务是真的能跑(`cargo test` + 面 A / 面 B 两把运行时尺子)。
#
# 🔴 运行时尺子默认读 `target/release/ssw-jnpf-lite-rust`
# ⇒ 改了源码**必须先** `cargo build --release`,否则打的是旧二进制。
# 本脚本在跑尺子前会自己 build 一次(省一次「假绿」)。
set -u
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
MODE="full"
if [ "${1:-}" = "--fast" ]; then
MODE="fast"
elif [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
sed -n '2,14p' "$0" | sed 's/^# \{0,1\}//'
exit 0
elif [ -n "${1:-}" ]; then
echo "未知参数:${1}(只认 --fast)"
exit 2
fi
PASS=0
FAIL=0
SLOW=()
step() {
local name="$1"
shift
local t0 t1 rc
t0="$(python3 -c 'import time;print(int(time.time()*1000))')"
echo
echo "▶ ${name}"
"$@"
rc=$?
t1="$(python3 -c 'import time;print(int(time.time()*1000))')"
local ms=$((t1 - t0))
if [ "${rc}" -eq 0 ]; then
PASS=$((PASS + 1))
echo " ✅ ${name}($((ms / 1000)).$(((ms % 1000) / 100))s)"
else
FAIL=$((FAIL + 1))
echo " ❌ ${name}($((ms / 1000)).$(((ms % 1000) / 100))s,rc=${rc})"
fi
SLOW+=("${ms}|${name}")
}
t_all0="$(python3 -c 'import time;print(int(time.time()*1000))')"
# ---- 1. 生成物(加包忘了跑 pack-sync 会在这里红)----
step "pack-sync --check" python3 "${ROOT}/scripts/pack-sync.py" --check
# ---- 2. 脚手架判据(本仓只准有业务)----
step "check-scaffold" python3 "${ROOT}/scripts/check-scaffold.py"
# ---- 3. 反自证(尺子自己也得被尺子量)----
step "check-scaffold --self-test" python3 "${ROOT}/scripts/check-scaffold.py" --self-test
# ---- 4. 全量测试 ----
step "cargo test --workspace" bash -c "cd '${ROOT}' && cargo test --workspace"
if [ "${MODE}" = "full" ]; then
# ---- 5. release 二进制(运行时尺子读它)----
step "cargo build --release" bash -c "cd '${ROOT}' && cargo build --release"
# ---- 6. 面 A:权限闭环 ----
step "perm-smoke(面 A)" bash "${ROOT}/scripts/perm-smoke.sh"
# ---- 7. 面 B:官方形状 ----
step "perm-smoke-jnpf(面 B)" bash "${ROOT}/scripts/perm-smoke-jnpf.sh"
fi
t_all1="$(python3 -c 'import time;print(int(time.time()*1000))')"
TOTAL=$((t_all1 - t_all0))
echo
echo "──────────────────────────────────────────"
echo "总耗时 $((TOTAL / 1000)).$(((TOTAL % 1000) / 100))s(模式 ${MODE},$((PASS + FAIL)) 个步骤)"
if [ "${FAIL}" -eq 0 ]; then
echo
echo "全 ✅ (${PASS}/${PASS})"
exit 0
fi
echo
echo "有失败 ❌ (PASS=${PASS} FAIL=${FAIL})"
exit 1