-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
97 lines (80 loc) · 2.25 KB
/
Makefile
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
all: debug
debug:
@clear
@echo "App API debug is loading"
@go run ./api/build/main.go -conf=./api/build/app.yaml
build:
@clear
@echo "App API is creating. Please wait ..."
@echo "App API compiling ..."
@go build -o ./app_api_tmp -v ./api/build/main.go
@rm -rf ./app_api
@mv ./app_api_tmp ./app_api
@echo "App API is created"
run:
@#clear
@echo "APP is loading. Please wait ..."
@./app_api -conf=./api/build/app.yaml
# 编译并运行项目当前 docker 内用
cr:
@make build
@make run
# 运行API项目
docker:
@mkdir -p /tmp/comic_api
@make -is docker_network
@docker-compose -p puppeteer-go down # 删除老的镜像
@# --compatibility 是限制系统资源
@# -p 设置项目名称以免使用相同镜像时提示异常
@# -d 以后台挂起的模式运行
@docker-compose --compatibility -p puppeteer-go up -d # 启动 docker-compile 编排
docker_network:
@docker network create --subnet=172.38.0.0/24 network_puppeteer_go # 创建 docker 网卡
ini:
@clear
@cp ./api/build/app.example.yaml ./api/build/app.yaml
@echo "API config.yaml initial success"
tool:
@clear
@go vet ./...; true
@gofmt -w .
clean:
@clear
@echo "Remove Old Apps ... "
@rm -rf ./app_api
@#rm -rf ./app_job # 2020-11-29 计划中
@#rm -rf ./app_admin # 2020-11-14 暂无计划
@go clean -i .
@echo "Remove Old Apps --- Done"
json:
@make jsoncommon
@make jsonapi
@clear
@echo "Creating all easyjson file success"
jsonclean:
@rm -rf common/model/*/*easyjson*.go
@rm -rf api/model/*easyjson*.go
jsoncommon:
@clear
@echo "Creating common easyjson file"
@rm -rf common/model/*/*easyjson*.go
@easyjson -all common/model/*/*.go # 格式化 json ,需要 https://github.com/mailru/easyjson
@echo "Created common/model/* easyjson file Success"
jsonapi:
@clear
@echo "Creating easyjson file for api/model/"
@rm -rf api/model/*easyjson*.go
@easyjson -all api/model/*.go # 格式化 json ,需要 https://github.com/mailru/easyjson
@echo "Created api/model/ easyjson file Success"
test:
@clear
@echo "Test --- START"
@# 全量测试---暂时不考虑
@# go test -v ./...
@# 指定测试
@go test -v ./api/service/ -conf=../../api/build/app.yaml
@echo "Test --- END"
lint:
@echo "Golint Scaning"
@golangci-lint run --config ./lint-ci.yml
@echo "Golint PASS"