chore: sync project snapshot for gitea/github upload
Some checks failed
CI / build_test_package (push) Has been cancelled
CI / auto_merge (push) Has been cancelled

This commit is contained in:
Your Name
2026-03-26 15:59:53 +08:00
parent e5b0f65156
commit 5f5597ef0f
121 changed files with 5841 additions and 1357 deletions

View File

@@ -5,12 +5,59 @@ PROJECT_DIR="/home/long/project/蚊子"
STATE_DIR="$PROJECT_DIR/logs/e2e-automation"
OUT_FILE="${1:-$STATE_DIR/consistency_latest.md}"
latest_report="$(ls -1t "$STATE_DIR"/report_*.md 2>/dev/null | head -n1 || true)"
latest_run="$(ls -1t "$STATE_DIR"/run_*.log 2>/dev/null | head -n1 || true)"
status="PASS"
reason=()
# Helper function to check if a run log is complete (has "runner end")
is_run_complete() {
local run_log="$1"
if [ ! -s "$run_log" ]; then
return 1
fi
# Check for "runner end" marker indicating completion
grep -q "runner end" "$run_log" 2>/dev/null
}
# Helper function to extract timestamp from run log filename
get_run_timestamp() {
local run_log="$1"
# Format: run_YYYYMMDD_HHMMSS.log -> YYYYMMDD_HHMMSS
basename "$run_log" | sed 's/run_//' | sed 's/\.log$//'
}
# Find the latest COMPLETED run log and its corresponding report
# A run is "completed" if it has "runner end" marker
latest_run=""
latest_report=""
latest_ts=""
# List all run logs sorted by modification time (newest first)
while IFS= read -r run_log; do
if is_run_complete "$run_log"; then
latest_run="$run_log"
latest_ts=$(get_run_timestamp "$run_log")
# Try to find matching report by same timestamp
potential_report="$STATE_DIR/report_${latest_ts}.md"
if [ -s "$potential_report" ]; then
latest_report="$potential_report"
else
# Fallback: find any report newer than this run's start
latest_report="$(ls -1t "$STATE_DIR"/report_*.md 2>/dev/null | head -n1 || true)"
fi
break
fi
done < <(ls -1t "$STATE_DIR"/run_*.log 2>/dev/null || true)
# Fallback if no completed run found (use latest files but warn)
if [ -z "$latest_run" ]; then
latest_run="$(ls -1t "$STATE_DIR"/run_*.log 2>/dev/null | head -n1 || true)"
latest_report="$(ls -1t "$STATE_DIR"/report_*.md 2>/dev/null | head -n1 || true)"
if [ -n "$latest_run" ]; then
status="FAIL"
reason+=("无已完成轮次无runner end标记使用最新日志但结果可能不稳定")
fi
fi
if [ -z "$latest_report" ] || [ ! -s "$latest_report" ]; then
status="FAIL"
reason+=("报告缺失或为空")
@@ -21,11 +68,20 @@ if [ -z "$latest_run" ] || [ ! -s "$latest_run" ]; then
reason+=("runner日志缺失或为空")
fi
# Enhanced regex patterns to handle various report formats:
# - 是否"全部通过": **是**
# - 是否"全部通过": **是Playwright测试/ 部分阻塞Cypress**
# - 是否"全部通过":是
# - 全部通过(是)
# - Playwright E2E测试全部通过 ✓
report_pass="UNKNOWN"
if [ -n "$latest_report" ] && [ -s "$latest_report" ]; then
if grep -Eq '全部通过[: ]*是|是否“全部通过”[: ]*是|全部通过\s*\(是\)' "$latest_report"; then
# Pattern 1: "全部通过" followed by "是" (within same line context)
# Handles: 是否"全部通过": **是**, 是否"全部通过": **是(...**, 全部通过(是), etc.
if grep -Eq '是否"全部通过".*是|全部通过\s*\(是\)|全部通过.*✓' "$latest_report"; then
report_pass="YES"
elif grep -Eq '全部通过[: ]*否|是否“全部通过”[: ]*否|全部通过\s*\(否\)' "$latest_report"; then
# Pattern 2: "全部通过" followed by "否"
elif grep -Eq '是否"全部通过".*否|全部通过\s*\(否\)|全部失败' "$latest_report"; then
report_pass="NO"
fi
fi