-
Notifications
You must be signed in to change notification settings - Fork 2
/
Taskfile.yml
214 lines (171 loc) · 4.4 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
204
205
206
207
208
209
210
211
212
213
version: "3"
################################################################################################
#
# ref:
# - https://taskfile.dev/#/usage
#
################################################################################################
#
# sub namespace: https://taskfile.dev/#/usage?id=including-other-taskfiles
#
includes:
os:
taskfile: ./taskfile/Taskfile_{{OS}}.yml
dir: ./taskfile/
base:
taskfile: ./taskfile/Taskfile_base.yml
dir: ./taskfile/
go:
taskfile: ./taskfile/Taskfile_base_go.yml
dir: ./taskfile/
flutter:
taskfile: ./taskfile/Taskfile_base_flutter.yml
dir: .
rust:
taskfile: ./taskfile/Taskfile_base_rust.yml
dir: ./taskfile/
zig:
taskfile: ./taskfile/Taskfile_base_zig.yml
dir: ./taskfile/
python:
taskfile: ./taskfile/Taskfile_base_python.yml
dir: ./taskfile/
# typescript / javascript / nodejs
ts:
taskfile: ./taskfile/Taskfile_base_typescript.yml
dir: ./taskfile/
git:
taskfile: ./taskfile/Taskfile_infra_git.yml
dir: ./taskfile/
nvim:
taskfile: ./taskfile/Taskfile_infra_nvim.yml
dir: ./taskfile/
ignore_error: true
vim:
taskfile: ./taskfile/Taskfile_infra_nvim.yml
dir: ./taskfile/
ignore_error: true
docker:
taskfile: ./taskfile/Taskfile_infra_docker.yml
dir: ./taskfile/
dockerfile:
aliases: [ 'df', "dockerfiles" ]
taskfile: ./dockerfile/
dir: ./dockerfile/
optional: true
compose:
aliases: [ 'dc', "docker-compose" ]
taskfile: ./docker-compose/local/
dir: ./docker-compose/local/
optional: true
packages:
aliases: [ "p", "pkg" ]
taskfile: ./packages/
dir: ./packages/
optional: true
################################################################################################
#
# 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:
tasks:
default:
cmds:
- task: echo
download:
cmds:
- chmod +x init.sh
- ./init.sh
init:
cmds:
- cp .env.local .env
echo:
cmds:
- echo "hello world"
# update itself:
update:
cmds:
- curl -fsSL https://github.com/raw/better-sre/config/main/init.sh | sh
up:infra:
cmds:
- task: docker:local:up:mysql
- task: docker:local:up:redis
- task: docker:local:up:consul:v3 # 服务发现/服务注册
- task: docker:local:up:jaeger # 链路追踪 # https://go-kratos.dev/docs/component/middleware/tracing
# - task: std:docker:local:up:prometheus
################################################################################################
use:
cmds:
- echo "setup user global taskfile root dir >> {{.TASK_ROOT_DIR}}"
- mkdir -p {{.TASK_ROOT_DIR}}
- echo "current dir >> $(pwd)"
- ln -sf $(pwd)/ {{.TASK_ROOT_DIR}} # link dir:
- ls -al {{.TASK_ROOT_DIR}}
- open {{.TASK_ROOT_DIR}}
vars:
TASK_ROOT_DIR: "~/.task/local/"
ignore_error: true
################################################################################
#
# 验证 nats 部署正常:
#
test:nats:sub:
cmds:
- go run sub/main.go
dir: ./script/nats/
test:nats:pub:
cmds:
- go run pub/main.go
dir: ./script/nats/
#
# unit test for this project:
#
test:
cmds:
- task --dry os:install:go-task
tests:
cmds:
- task --dry os:init
- task --dry rust:init
################################################################################
pull:
aliases: [ "pl" ]
cmds:
- git config pull.rebase false
- git pull origin main
fetch:
aliases: [ "f" ]
cmds:
- git fetch
- git rebase
- git merge origin/main
quick:
aliases: [ "q" ]
cmds:
- task: commit
- task: commit
# - task: pull
- task: push
commit:
aliases: [ "c" ]
cmds:
- git add .
- |
git commit -m 'chore: update' --no-verify
ignore_error: true
push:
aliases: [ "p" ]
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