From c6df735caa096337bbe18446b0de35950783869d Mon Sep 17 00:00:00 2001 From: xfy Date: Fri, 24 Apr 2026 08:11:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(make):=20=E6=B7=BB=E5=8A=A0=20act=20?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E7=94=A8=E4=BA=8E=E6=9C=AC=E5=9C=B0=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - make act: 运行完整 CI - make act-unit: 仅运行单元测试 job Co-Authored-By: Claude Opus 4.7 --- Makefile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Makefile b/Makefile index 9ffe8f8..7daf55a 100644 --- a/Makefile +++ b/Makefile @@ -169,6 +169,26 @@ test-cover: go tool cover -html=coverage.out -o coverage.html @echo "Coverage report: coverage.html" +# 运行 act 本地 CI 测试 +act: + @echo "Running CI locally with act..." + @if command -v act >/dev/null 2>&1; then \ + mkdir -p /tmp/artifacts && act --artifact-server-path /tmp/artifacts; \ + else \ + echo "act 未安装,运行: go install github.com/nektos/act@latest"; \ + exit 1; \ + fi + +# 运行 act 单个 job +act-unit: + @echo "Running unit tests job with act..." + @if command -v act >/dev/null 2>&1; then \ + mkdir -p /tmp/artifacts && act -j unit --artifact-server-path /tmp/artifacts; \ + else \ + echo "act 未安装,运行: go install github.com/nektos/act@latest"; \ + exit 1; \ + fi + # 运行基准测试 bench: @echo "Running benchmarks..." @@ -344,6 +364,8 @@ help: @echo "Testing:" @echo " make test - Run all tests" @echo " make test-cover - Run tests with coverage" + @echo " make act - Run CI locally with act" + @echo " make act-unit - Run unit tests job with act" @echo " make bench - Run benchmarks" @echo " make bench-stat - Run benchmarks with statistical sampling (10x)" @echo " make bench-compare - Compare against baseline (needs benchstat)"