Files
wangjia b05d7ed416 merge: oapi-codegen 接线 + 生成代码入库 [tsk_Kp80nvHV2yLc]
# Conflicts:
#	server/Makefile
#	server/cmd/server/main.go
#	server/go.mod
#	server/go.sum
2026-06-13 17:32:25 +08:00

63 lines
3.4 KiB
Makefile
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.
.PHONY: build test test-unit test-integration vet lint generate migrate-up migrate-down build-codegen deps proto proto-lint proto-breaking
.PHONY: build test test-unit test-integration vet lint generate check-generate migrate-up migrate-down build-codegen deps
# ── deps ───────────────────────────────────────────────────────────────────────
deps:
go mod tidy
go mod download
# ── build ──────────────────────────────────────────────────────────────────────
build:
go build ./...
build-codegen: ## 激活码批次生成 CLI
go build -o bin/codegen ./cmd/codegen
build-agent: ## 节点 agent 二进制(部署到加速节点)
go build -o bin/pangolin-agent ./cmd/agent
# ── test ───────────────────────────────────────────────────────────────────────
test:
go test ./...
test-unit: ## 单测(不依赖外部服务)
go test -count=1 -race ./internal/codes/... -run 'Test[^I][^n][^t]'
test-agent: ## 节点 agent 单测 + 集成(bufconn mock 控制面,无需 docker
go test -count=1 -race ./internal/agentd/... ./internal/pb/...
test-integration: ## 集成测试(需本机 dockertestcontainers
go test -count=1 ./internal/codes/... -run TestInt
# ── vet / lint ─────────────────────────────────────────────────────────────────
vet:
go vet ./...
lint:
golangci-lint run ./...
# ── generate ───────────────────────────────────────────────────────────────────
generate:
go generate ./...
check-generate: ## CI guard: regenerate and fail if generated files changed
go generate ./...
git diff --exit-code server/api/gen
# ── proto ──────────────────────────────────────────────────────────────────────
proto: ## 从 proto/ 生成 internal/pb/ 代码(buf generate
go run github.com/bufbuild/buf/cmd/buf@v1.70.0 generate
proto-lint: ## 检查 proto 语法与命名规范(buf lint
go run github.com/bufbuild/buf/cmd/buf@v1.70.0 lint
proto-breaking: ## 与 main 分支对比检测 breaking changebuf breaking
## 注:proto 首次合入 main 前,main 无 .proto 文件,此命令预期报"had no .proto files"
## proto 合入 main 后,后续所有变更须通过此检查,无报错视为通过。
go run github.com/bufbuild/buf/cmd/buf@v1.70.0 breaking --against '../.git#branch=main,subdir=server'
# ── migrate ────────────────────────────────────────────────────────────────────
migrate-up:
@echo "migrate-up: see cmd/migrate"
migrate-down:
@echo "migrate-down: see cmd/migrate"