-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (61 loc) · 1.68 KB
/
Copy pathMakefile
File metadata and controls
74 lines (61 loc) · 1.68 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
# 初始化项目环境
.PHONY: setup
setup:
@sh ./scripts/setup.sh
# 格式化代码
.PHONY: fmt
fmt:
@goimports -l -w $$(find . -type f -name '*.go' -not -path "./.idea/*" -not -path "./**/ioc/wire_gen.go" -not -path "./**/ioc/wire.go")
@gofumpt -l -w $$(find . -type f -name '*.go' -not -path "./.idea/*" -not -path "./**/ioc/wire_gen.go" -not -path "./**/ioc/wire.go")
# 清理项目依赖
.PHONY: tidy
tidy:
@go mod tidy -v
.PHONY: check
check:
@$(MAKE) --no-print-directory fmt
@$(MAKE) --no-print-directory tidy
# 代码规范检查
.PHONY: lint
lint:
@golangci-lint run -c ./scripts/lint/.golangci.yaml ./...
# 单元测试
.PHONY: ut
ut:
@go test -race -shuffle=on -short -failfast -tags=unit ./...
# 集成测试
.PHONY: e2e_up
e2e_up:
@docker compose -p notification-platform -f scripts/test_docker_compose.yml up -d
.PHONY: e2e_down
e2e_down:
@docker compose -p notification-platform -f scripts/test_docker_compose.yml down -v
.PHONY: e2e
e2e:
@$(MAKE) e2e_down
@$(MAKE) e2e_up
@go test -race -shuffle=on -failfast -tags=e2e ./...
@$(MAKE) e2e_down
# 基准测试
.PHONY: bench
bench:
@go test -bench=. -benchmem ./...
# 生成gRPC相关文件
.PHONY: grpc
grpc:
@buf format -w api/proto
@buf lint api/proto
@buf generate api/proto
# 生成go代码
.PHONY: gen
gen:
@go generate ./...
.PHONY: run_platform_only
run_platform_only:
@cd cmd/platform && export EGO_DEBUG=true && go run main.go --config=../../config/config.yaml
.PHONY: run_platform
run_platform:
@$(MAKE) e2e_down
@$(MAKE) e2e_up
@sleep 15
@cd cmd/platform && export EGO_DEBUG=true && go run main.go --config=../../config/config.yaml