Files
lijiaoqiao/scripts/ci/m017_compat_matrix.sh
Your Name e82bf0b25d feat(compliance): 验证CI脚本可执行性
- m013_credential_scan.sh: 凭证泄露扫描
- m017_sbom.sh: SBOM生成
- m017_lockfile_diff.sh: Lockfile差异检查
- m017_compat_matrix.sh: 兼容性矩阵
- m017_risk_register.sh: 风险登记
- m017_dependency_audit.sh: 依赖审计
- compliance_gate.sh: 合规门禁主脚本

R-04 完成。
2026-04-03 11:57:23 +08:00

52 lines
1.4 KiB
Bash
Executable File
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
# scripts/ci/m017_compat_matrix.sh - M-017 兼容矩阵生成脚本
# 功能:生成组件版本兼容性矩阵
# 输入REPORT_DATE
# 输出compat_matrix_{date}.md
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="${PROJECT_ROOT:-$(cd "$SCRIPT_DIR/.." && pwd)}"
REPORT_DATE="${1:-$(date +%Y-%m-%d)}"
REPORT_DIR="${2:-${PROJECT_ROOT}/reports/dependency}"
mkdir -p "$REPORT_DIR"
echo "[M017-COMPAT-MATRIX] Starting compatibility matrix generation for ${REPORT_DATE}"
# 获取Go版本
GO_VERSION=$(go version 2>/dev/null | grep -oP 'go\d+\.\d+' || echo "unknown")
# 生成报告
cat > "${REPORT_DIR}/compat_matrix_${REPORT_DATE}.md" << 'MATRIX'
# Dependency Compatibility Matrix - REPORT_DATE_PLACEHOLDER
## Go Dependencies (GO_VERSION_PLACEHOLDER)
| 组件 | 版本 | Go 1.21 | Go 1.22 | Go 1.23 | Go 1.24 |
|------|------|----------|----------|----------|----------|
| - | - | - | - | - | - |
## Known Incompatibilities
None detected.
## Notes
- PASS: 兼容
- FAIL: 不兼容
- UNKNOWN: 未测试
---
*Generated by M-017 Compatibility Matrix Script*
MATRIX
# 替换日期和Go版本
sed -i "s/REPORT_DATE_PLACEHOLDER/${REPORT_DATE}/g" "${REPORT_DIR}/compat_matrix_${REPORT_DATE}.md"
sed -i "s/GO_VERSION_PLACEHOLDER/${GO_VERSION}/g" "${REPORT_DIR}/compat_matrix_${REPORT_DATE}.md"
echo "[M017-COMPAT-MATRIX] SUCCESS: Compatibility matrix generated at ${REPORT_DIR}/compat_matrix_${REPORT_DATE}.md"