-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
168 lines (128 loc) · 7.19 KB
/
Copy pathMakefile
File metadata and controls
168 lines (128 loc) · 7.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# AgentHub — CI / Pre-push Test Suite
# Usage: make test (unit tests, no external deps)
# make test-all (all tests including integration)
# make lint (golangci-lint)
# make coverage (HTML coverage report)
# make fe-lint (frontend eslint + stylelint)
# make fe-build (build all frontend packages)
# make release (via git push tag -> release.yml, not built here)
# make help (show this help)
.PHONY: test test-all test-edge test-edge-full test-hub test-hub-full test-edge-e2e test-teamrun test-oidc test-hub-integration e2e-local lint coverage sec bench ci release clean fmt \
fe-install fe-dev fe-build fe-test fe-lint fe-typecheck fe-coverage-baseline help
# ── Help ───────────────────────────────────────────
help:
@echo "AgentHub Makefile targets:"
@echo ""
@echo " Backend:"
@echo " test 单元测试 (edge + hub, -short)"
@echo " test-all 完整测试 (需 Redis + PG)"
@echo " test-edge Edge Server 单元测试"
@echo " test-edge-e2e Edge→Hub 回调冒烟 (零外部依赖, 进程内 mock hub)"
@echo " test-hub Hub Server 单元测试"
@echo " test-teamrun 团队编排 smoke (零外部依赖, in-memory sqlite)"
@echo " test-oidc OIDC/scenarios smoke (零外部依赖)"
@echo " test-hub-integration Hub 集成 lane (需 PG + Redis)"
@echo " e2e-local 零依赖 E2E 组合: edge-e2e + teamrun + oidc"
@echo " lint golangci-lint (edge + hub)"
@echo " coverage 覆盖率报告 (HTML + func)"
@echo " sec gosec + govulncheck"
@echo " bench Benchmark (对齐 CI benchmark job: events+adapters / service+jwtutil)"
@echo " ci 全量 CI: test + lint + sec"
@echo " clean 清理测试缓存和覆盖率文件"
@echo ""
@echo " Frontend:"
@echo " fe-install pnpm install"
@echo " fe-dev pnpm dev (desktop :5173)"
@echo " fe-build build web + desktop(mobile 为 Expo,无产物构建)"
@echo " fe-test pnpm -r test"
@echo " fe-lint eslint + stylelint"
@echo " fe-typecheck tsc --noEmit (desktop + web)"
@echo " fe-coverage-baseline 在干净且已同步的 master 重测四包并仅上调 coverage baseline"
@echo ""
@echo " Release:"
@echo " release 发布 = git push tag(触发 release.yml)"
@echo ""
# ── Unit tests (no external deps) ────────────────────
test: test-edge test-hub
test-edge:
cd edge-server && go test ./... -short -count=1 -timeout 60s
# Edge→Hub 回调冒烟:mock hub + 进程内 edge,零外部依赖(不需 PG/Redis/真实 CLI)。
# 覆盖 ack/stream/done/fail 直连回调链;-short 下这些用例会被跳过,故单独入口。
test-edge-e2e:
cd edge-server && go test ./tests/ -count=1 -run "^TestHubE2E_" -timeout 120s
test-hub:
cd hub-server && go test ./... -short -count=1 -timeout 60s
# 零外部依赖的 E2E smoke(in-memory sqlite,无 build tag,CI 直跑)。
test-teamrun:
cd hub-server && go test ./tests/teamrun/ -count=1 -timeout 60s
test-oidc:
cd hub-server && go test ./tests/oidc/ ./tests/scenarios/ -count=1 -timeout 60s
# Hub 集成 lane(//go:build integration,需 PG + Redis service 容器)。
test-hub-integration:
cd hub-server && go test -tags integration ./tests/integration/ -count=1 -timeout 300s
# 零依赖 E2E 组合(无需 PG/Redis/真实 CLI)。
e2e-local: test-edge-e2e test-teamrun test-oidc
# ── Full tests (requires Redis + PG) ─────────────────
# test-all 含 integration lane(//go:build integration,需 PG + Redis service 容器)。
test-all: test-edge-full test-hub-full test-hub-integration
test-edge-full:
cd edge-server && go test ./... -count=1 -timeout 120s -race
test-hub-full:
cd hub-server && go test ./... -count=1 -timeout 120s -race
# ── Benchmarks ───────────────────────────────────
# 范围与 checks.yml 的 benchmark job 一致(edge events+adapters、hub service+jwtutil)。
bench:
cd edge-server && go test -bench=. -benchmem ./internal/events/ ./internal/adapters/
cd hub-server && go test -bench=. -benchmem ./internal/service/ ./internal/jwtutil/
# ── Lint ─────────────────────────────────────────
lint:
cd edge-server && golangci-lint run ./...
cd hub-server && golangci-lint run ./...
# ── Format ───────────────────────────────────────
fmt:
cd edge-server && gofmt -w .
cd hub-server && gofmt -w .
# ── Coverage ─────────────────────────────────────
coverage:
cd edge-server && go test ./... -short -coverprofile=coverage.out && go tool cover -html=coverage.out -o coverage.html
cd hub-server && go test ./... -short -coverprofile=coverage.out && go tool cover -func=coverage.out
# ── Security ─────────────────────────────────────
sec:
cd edge-server && gosec ./...
cd hub-server && gosec ./...
cd edge-server && govulncheck ./...
cd hub-server && govulncheck ./...
# ── All checks (CI pipeline) ─────────────────────
ci: test lint sec
# ── Release ─────────────────────────────────────
# 发布入口已收敛(2026-08-02):唯一入口 = git tag vX.Y.Z[-rc.N] → push → release.yml(AGENTS.md §12)。
# release.ps1 已删除;本地不再上传二进制。本地 `make release` 不再假绿灯
# (审计):它只提醒走 release.yml 并以 exit 1 失败,避免被误当作发布成功。
release:
@echo "release is via git push tag -> release.yml" >&2; exit 1
# ── Clean ────────────────────────────────────────
clean:
cd edge-server && go clean -testcache
cd hub-server && go clean -testcache
rm -f edge-server/coverage.out edge-server/coverage.html
rm -f hub-server/coverage.out hub-server/coverage.html
# ── Frontend ─────────────────────────────────────
fe-install:
cd app && pnpm install
fe-dev:
cd app && pnpm dev
fe-build:
# mobile-rn 是 Expo 开发构建(无产物 build script),只 build 有产物的 web/desktop
cd app && pnpm --filter agenthub-web --filter agenthub-desktop build
fe-test:
cd app && pnpm -r test
# 仅用于“提高/刷新”前端 coverage baseline:脚本会拒绝非 master、脏树、
# 未同步 origin/master、partial package 或任何自动降基线,避免写入不可追溯 SHA。
fe-coverage-baseline:
python scripts/verify/verify-coverage-baseline.py --WriteBaseline
fe-lint:
cd app && pnpm -r lint
cd app && pnpm lint:css
fe-typecheck:
cd app/desktop && npx tsc --noEmit
cd app/web && npx tsc --noEmit