Files
mce/scripts/ci.sh

46 lines
953 B
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.

#!/bin/bash
# CI 流水线脚本
# 调用方式bash scripts/ci.sh [--strict]
# --strict 阻断模式lint 失败则 exit 1
# 默认 报告模式lint 只输出不阻断)
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
STRICT=false
if [[ "${1:-}" == "--strict" ]]; then
STRICT=true
fi
echo "========================================"
echo " CI Pipeline"
echo " Mode: $( $STRICT && echo 'STRICT' || echo 'REPORT' )"
echo "========================================"
# 1. 格式检查
echo ""
echo "==> 1/3 格式检查 (gofumpt + goimports)"
make fmt-check
# 2. 编译检查
echo ""
echo "==> 2/3 编译检查 (go build)"
go build ./...
# 3. 静态分析
echo ""
echo "==> 3/3 静态分析 (golangci-lint)"
if $STRICT; then
make lint-strict
else
make lint
fi
echo ""
echo "========================================"
echo " CI Pipeline 完成"
echo "========================================"