mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-07 12:57:57 +08:00
插件化改造前置:把'绝不回归'变成机器可验证的硬约束。 - 透传特征化:anthropic 逐字节/SSE 逐事件、openai、gemini 路径与错误透传 - 计费不变量:5m/1h 双档缓存价、倍率叠加顺序、overages、端到端金额与配额增量 - 调度不变量:粘性会话、failover 10/3/3 完整循环、并发槽配平、等待队列 - 热路径基准基线 + scripts/bench-baseline.sh(allocs 严格/ns 15%/基准缺失 FAIL) - Makefile test-invariants 目标 + CI invariants job;修复失效的 test-e2e 脚本引用 - .gitignore:放行 backend/scripts 与 docs/plugin-architecture(既有白名单模式) 注:本分支按整体门禁验证(部分测试夹具引用后续提交的签名,中间提交不保证独立编译)。
41 lines
1.2 KiB
Makefile
41 lines
1.2 KiB
Makefile
.PHONY: build generate test test-unit test-integration test-e2e test-invariants new-module
|
||
|
||
VERSION ?= $(shell tr -d '\r\n' < ./cmd/server/VERSION)
|
||
LDFLAGS ?= -s -w -X main.Version=$(VERSION)
|
||
|
||
build:
|
||
CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -trimpath -o bin/server ./cmd/server
|
||
|
||
generate:
|
||
go generate ./ent
|
||
go generate ./cmd/server
|
||
|
||
test:
|
||
go test ./...
|
||
golangci-lint run ./...
|
||
|
||
test-unit:
|
||
go test -tags=unit ./...
|
||
|
||
test-integration:
|
||
go test -tags=integration ./...
|
||
|
||
# 插件化改造回归安全网(特征化/不变量测试,详见 .claude/plugin-refactor/INVARIANTS.md)
|
||
test-invariants:
|
||
go test -tags=unit -count=1 -run 'Characterization|Invariant' ./internal/...
|
||
|
||
# 生成插件模块骨架:make new-module ID=job.foo
|
||
# (生成后按提示在 internal/modules/standard/imports.go 手工加 import 行)
|
||
new-module:
|
||
ifndef ID
|
||
$(error ID is required: make new-module ID=job.foo)
|
||
endif
|
||
go run ./tools/newmodule -id "$(ID)"
|
||
|
||
# scripts/e2e-test.sh 已不存在,test-e2e 与 test-e2e-local 等价(env 驱动的真实服务 e2e)
|
||
test-e2e:
|
||
go test -tags=e2e -v -timeout=300s ./internal/integration/...
|
||
|
||
test-e2e-local:
|
||
go test -tags=e2e -v -timeout=300s ./internal/integration/...
|