Files
xiaoxia-saas/scripts/ci/generate_ci_dashboard.sh
T
xiaoxia a3204a6d67
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 3s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 45s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 2m48s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 49s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 22s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 1m21s
CI/CD Pipeline / PR Build API Image (pull_request) Failing after 1m41s
Preview Deploy / Deploy Preview Environment (pull_request) Failing after 16s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 39s
AI Code Review / AI Code Review (pull_request) Successful in 55s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 4m25s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m25s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 9m25s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1316h15m34s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 1316h16m21s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1316h16m23s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1316h16m25s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1316h17m26s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 1316h25m37s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 1316h30m13s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 1316h30m15s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 1316h30m17s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 1316h30m19s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Failing after 1316h33m18s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 1316h33m39s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 1316h33m43s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 1317h6m2s
chore(ci): 同步main分支CI配置与scripts/ci脚本 - 与develop对齐
2026-07-23 18:46:44 +08:00

98 lines
2.5 KiB
Bash
Raw 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
#
# CI 健康度看板一键生成脚本
# - 从 Gitea Actions API 拉取数据
# - 生成 HTML 可视化看板
# - 输出文件路径
#
# 用法:
# bash scripts/ci/generate_ci_dashboard.sh [--days 7] [--output ci_dashboard.html]
#
# 环境变量:
# GITEA_TOKEN API Token(必需)
# GITEA_URL Gitea 地址(可选,默认 https://git.xiaoxiajianji.com)
# GITEA_REPO 仓库(可选,默认 xiaoxia/xiaoxia-saas)
#
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
# 默认参数
DAYS=7
OUTPUT="ci_dashboard.html"
# 解析参数
while [[ $# -gt 0 ]]; do
case "$1" in
--days)
DAYS="$2"
shift 2
;;
--output|-o)
OUTPUT="$2"
shift 2
;;
--help|-h)
echo "用法: bash scripts/ci/generate_ci_dashboard.sh [--days 7] [--output ci_dashboard.html]"
echo ""
echo "选项:"
echo " --days N 统计最近 N 天 (默认 7)"
echo " --output PATH HTML 输出路径 (默认 ci_dashboard.html)"
echo " --help 显示帮助"
echo ""
echo "环境变量:"
echo " GITEA_TOKEN API Token(必需)"
echo " GITEA_URL Gitea 地址"
echo " GITEA_REPO 仓库"
exit 0
;;
*)
echo "未知参数: $1"
exit 1
;;
esac
done
# 检查 Python
if ! command -v python3 &> /dev/null; then
echo "[ERROR] 未找到 python3,请先安装 Python 3"
exit 1
fi
# 检查 Token
if [[ -z "${GITEA_TOKEN:-}" ]]; then
echo "[ERROR] 请设置 GITEA_TOKEN 环境变量"
exit 1
fi
echo "========================================"
echo " CI 健康度看板生成器"
echo "========================================"
echo ""
echo "统计天数: ${DAYS} 天"
echo "输出文件: ${OUTPUT}"
echo ""
# 生成 HTML 看板
echo "[INFO] 正在拉取数据并生成看板..."
python3 "${SCRIPT_DIR}/ci_dashboard.py" \
--days "${DAYS}" \
--html \
--html-output "${OUTPUT}"
echo ""
echo "========================================"
echo " ✅ 看板生成完成!"
echo "========================================"
echo ""
echo "文件路径: $(realpath "${OUTPUT}")"
echo ""
# 如果在 macOS 上,尝试打开
if [[ "$(uname)" == "Darwin" ]]; then
echo "[INFO] 正在打开浏览器..."
open "${OUTPUT}"
fi