-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
254 lines (215 loc) · 5.7 KB
/
Copy pathTaskfile.yml
File metadata and controls
254 lines (215 loc) · 5.7 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
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
version: "3"
includes:
uuid-ffi:
aliases: ["ffi", "uf"]
taskfile: ./uuid-ffi/
dir: ./uuid-ffi/
optional: true
vars:
VAR1: "some-var"
# global env:
env:
ENV1: testing
WORKSPACE: "packages/"
# env file:
dotenv:
- .env
################################################################################################
tasks:
doctor:
aliases: ["check"]
cmds:
- task --version
- cargo -V
- pixi -V
- rattler-build -V
- pixi run mojo --version
setup:
aliases: ["s"]
cmds:
- task: install:pixi
- task: install:rattler-build
# https://taskfile.dev/docs/installation
install:taskfile:ubuntu:
aliases: ["i:task:ubuntu"]
cmds:
- curl -1sLf 'https://dl.cloudsmith.io/public/task/task/setup.deb.sh' | sudo -E bash
- apt install -y task # ubuntu/debian
install:taskfile:macos:
aliases: ["i:task:macos"]
cmds:
- brew install go-task # macos
# https://rust-lang.org/tools/install/
install:rust:
aliases: ["i:rust", "i:rs"]
cmds:
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- cargo -V
install:pixi:
aliases: ["i:pixi"]
cmds:
- curl -fsSL https://pixi.sh/install.sh | sh
- pixi global install rattler-build
# https://rattler-build.prefix.dev/latest/#installation
install:rattler-build:
aliases: ["i:rb"]
cmds:
- pixi global install rattler-build
install:skills:
aliases: ["i:skills"]
cmds:
- npx skills add modular/skills
pixi:
cmds:
- pixi {{.CLI_ARGS}}
install:
aliases: ["i"]
cmds:
- pixi install # 安装 pixi 依赖包
run:mojo:
aliases: ["r:mojo", "run", "r"]
cmds:
- pixi run mojo -I . examples/main.mojo
##########################################################################
# 编译发布 Linux-64 版本, 基于 orbstack 虚拟机
shell:linux-64:
aliases: ["sh:linux-64", "sh:linux"]
cmds:
- orbctl run -m u22build
# 编译发布 Linux-aarch64 版本, 基于 orbstack 虚拟机
shell:linux-aarch64:
aliases: ["sh:linux-aarch64"]
cmds:
- orbctl run -m u22dev
release:
aliases: ["rel"]
cmds:
- task: release:rs
- task: release:mojo
# release + publish ffi package
release:rs:
aliases: ["rel:rs"]
cmds:
- task: del
- pixi run build-rs
- task: publish:ffi
# release + publish mojo package
release:mojo:
aliases: ["rel:mojo"]
cmds:
- task: del
- pixi run build-mojo
- task: publish:mojo
#
# ref: https://taskfile.dev/usage/#looping-over-variables
#
publish:ffi:
aliases: ["upf", "up:ffi", "pub", "pub:auto"]
vars:
UP_PKGS:
sh: find . -name "libuuid_ffi-*.conda" -type f
cmds:
- echo $PREFIX_DEV_API_KEY
- echo {{ .UP_PKGS }}
- for: { var: UP_PKGS }
cmd: |
pixi run -e=dev rattler-build upload prefix -c "better-ffi" \
--api-key=$PREFIX_DEV_API_KEY \
{{.ITEM}}
- open https://prefix.dev/channels/better-ffi/packages/libuuid_ffi
dir: output/
publish:mojo:
aliases: ["up", "up:mojo", "pub", "pub:auto"]
vars:
UP_PKGS:
sh: find . -name "uuid-*.conda" -type f
cmds:
- echo {{ .UP_PKGS }}
- for: { var: UP_PKGS }
cmd: |
pixi run -e=dev rattler-build upload prefix -c "better-mojo" \
--api-key=$PREFIX_DEV_API_KEY \
{{.ITEM}}
- open https://prefix.dev/channels/better-mojo
- open https://prefix.dev/channels/better-mojo/packages/uuid
dir: output/
clean:
aliases: ["del"]
cmds:
- rm -rf output/
docs:
cmds:
- pixi i -e=dev
- pixi run -e=dev mkdocs serve --open --watch=docs --watch=mkdocs.yml --dev-addr=localhost:5005
docs:deploy:
aliases: ["docs:d"]
cmds:
- pixi i -e=dev
- pixi run -e=dev mkdocs gh-deploy # build and create gh-pages branch
- git push origin gh-pages:gh-pages --force # push to public repo
dev:
cmds:
- rustup toolchain install nightly
- rustup toolchain list
rsync:
aliases: ["rs"]
cmds: # 忽略目录 = [.git/, .github/, ], 改写成 for 循环
- |
for repo in {{.REPOS}}; do
rsync -avzdelete-after --exclude=".git/" --exclude=".github/" ./tmp/$repo/ ./packages/$repo/
done
vars:
REPOS: "flare sqlite morph json envo mobin"
clone:
aliases: ["cl"]
cmds:
- git clone git@github.com:better-mojo/sqlite.git
- git clone git@github.com:better-mojo/morph.git
- git clone git@github.com:ehsanmok/json.git
- git clone git@github.com:ehsanmok/envo.git
dir: ./tmp/
ignore_error: true
################################################################################
count:
cmds:
- tokei # 代码统计: https://github.com/XAMPPRocky/tokei
quick:
aliases: ["q"]
cmds:
- task: cc
- task: push
# usage: task rc -- 2
rc:
aliases: ["reset:commit"]
cmds:
- git reset --soft HEAD~{{.CLI_ARGS}}
- task: c
cc:
cmds:
- task: commit
- task: commit
commit:
aliases: ["c"]
cmds:
- git add .
- git status
- |
git commit -m 'chore: 💪 update' --no-verify
ignore_error: true
commit:ai:
aliases: ["c:ai"]
cmds:
- git add .
- git status
- |
git commit -m 'chore: 🤖 update' --no-verify
ignore_error: true
pull:
cmds:
- git config pull.rebase false
- git pull origin main
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