-
Notifications
You must be signed in to change notification settings - Fork 53
/
Taskfile.yml
204 lines (156 loc) · 4.24 KB
/
Taskfile.yml
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
version: '3'
################################################################################################
#
# ref:
# - https://taskfile.dev/#/usage
#
################################################################################################
#
# sub namespace: https://taskfile.dev/#/usage?id=including-other-taskfiles
#
includes:
os:
taskfile: ./script/Taskfile_{{OS}}.yml
dir: ./script
base:
taskfile: ./script/Taskfile_base.yml
dir: .
go:
taskfile: ./script/Taskfile_base_go.yml
dir: .
local:
taskfile: ./deploy/local
dir: ./deploy/local
docs:
taskfile: ./docs/v2
dir: ./docs/v2
#
# 待测试的服务根目录:
#
app:demo:
taskfile: ./infra/template/style2
dir: ./infra/template/style2
app:queue:
taskfile: ./app/core/queue
dir: ./app/core/queue
user:
taskfile: app/core/user/member/
dir: app/core/user/member/
authn:
taskfile: app/core/user/authn/
dir: app/core/user/authn/
authz:
taskfile: ./app/core/user/authz
dir: ./app/core/user/authz
sms:
taskfile: app/core/notification/sms
dir: app/core/notification/sms
email:
taskfile: ./app/core/notification/email
dir: ./app/core/notification/email
license:key:
taskfile: ./app/unit/license/key
dir: ./app/unit/license/key
################################################################################################
#
# global vars: https://taskfile.dev/#/usage?id=variables
#
vars:
VAR1: "some-var"
#
# global env: https://taskfile.dev/#/usage?id=environment-variables
#
env:
ENV1: testing-env
# env file:
dotenv:
- .env
################################################################################################
#
# task groups: https://taskfile.dev/#/usage?id=task-directory
#
tasks:
default:
cmds:
- task: init
- task: run
init:
cmds:
- cp .env.local .env
- task: os:init
- task: go:init
tidy:
cmds:
# - go mod tidy -v
- task: app:demo:tidy
- task: app:queue:tidy
- go work sync
update:
cmds:
- export GOPROXY=https://goproxy.cn; go get -u -v github.com/better-go/[email protected]
- echo $GOPROXY
# - export GOPROXY=https://goproxy.cn; go get -u -v github.com/tal-tech/[email protected]
# - export GOPROXY=https://goproxy.cn; go get -u -v github.com/tal-tech/[email protected]
version:
cmds:
- task: os:version
- task: go:version
################################################################################################
infra:
cmds:
- task: local:init
infra:stop:
cmds:
- task: local:clean
################################################################################################
# 项目全局 + 批量生成:
proto:gen:all:
cmds:
- |
find ./app -iname "*.proto" -exec \
protoc --proto_path=. \
--proto_path=$(pwd)/pkg/x \
--go_out=paths=source_relative:. \
--go-http_out=paths=source_relative:. \
--go-grpc_out=paths=source_relative:. \
--validate_out=paths=source_relative,lang=go:. \
--openapi_out==paths=source_relative:. \
{} \;
run:
cmds:
- task: app:demo:run # set app first
api:test:
cmds:
- task: app:demo:api:test
################################################################################################
new-app-basic:
cmds:
- task: go:app-gen-basic
new-app-biz:
cmds:
- task: go:app-gen-biz
new-service-api:
cmds:
- goctl api new ./tmp/demo
new-service-rpc:
cmds:
- goctl rpc new ./tmp/demo
new-service-proto:
cmds:
- goctl rpc template -o ./tmp/demo.proto
################################################################################################
new:api:
cmds:
- goctl api new hello
new:api:docker:
- cd hello; goctl docker -go hello.go
new:rpc:
cmds:
- goctl rpc new hello_rpc
build:docker:api:
cmds:
- docker build -t hello:v1 -f hello/Dockerfile .
push:
cmds:
- git push origin main --tags
- repo_url=`git remote -v | grep push | awk -F ":" '{print $2}' | awk -F ".git" '{print "https://github.com/"$1}'`; open $repo_url