Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
227 lines (192 loc) · 5.59 KB
/
Copy pathTaskfile.yml
File metadata and controls
227 lines (192 loc) · 5.59 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
version: '3'
vars:
CU: '{{ if eq .OS "Windows_NT" }}coreutils{{ else }}{{ end }}'
CORE_DIR: core
UI_DIR: ui
DOCKER_IMG: glacier
# Directory for Go source commands
GO_CMD_DIR: cmd
# Directory for build output
BUILD_DIR: .build
DEV: dev
tasks:
default:
desc: "Lists all available tasks"
cmds:
- task --list --sort=alphanumeric
mig:*:
desc: creates migrates for glacier
dir: core/internal
vars:
MIG: "{{index .MATCH 0}}"
cmds:
- 'atlas migrate diff {{.MIG}} --env sqlite'
- 'atlas migrate diff {{.MIG}} --env postgres'
##########################A##########################################################################
# .build
bddr:
vars:
DEFAULT_OUT: '{{.BUILD_DIR}}'
TARG: '{{.TARG| default .DEFAULT_TARG}}'
cmds:
- 'mkdir -p {{.BUILD_DIR}}/{{.TARG}}'
init:
deps:
- go:download
- ui:install
go:download:
dir: "{{.CORE_DIR}}"
cmds:
- go mod download
ui:install:
dir: "{{.UI_DIR}}"
cmds:
- npm i
frost:
vars:
SAFE_ROOT: '{{.TASKFILE_DIR | toSlash}}'
OUT: "{{.SAFE_ROOT}}/{{.BUILD_DIR}}/frost/{{OS}}"
UI: "{{.OUT}}/ui/"
cmds:
- task frost:ui:desk OUT={{.UI}}
- task frost:go OUT={{.OUT}}/frost
frost:go:
cmds:
- task ui:b:frost FROST=1
- task go:b:frost PROD=1 OUT_EXE={{.OUT}}
frost:ui:desk:
dir: "{{ .UI_DIR }}"
vars:
ELECTRON: '{{if eq OS "windows"}}win-unpacked{{else}}linux-unpacked{{end}}'
cmds:
- npm run desk:build
- '{{.CU}} mkdir -p {{.OUT}}'
- '{{.CU}} cp -r release/{{.ELECTRON}}/. {{.OUT}}/'
bb:
vars:
EXE_EXT: '{{if eq OS "windows"}}.exe{{end}}'
cmds:
- cd {{.CORE_DIR}} && go install -ldflags "-s -w" ./cmd/builder
- "builder{{.EXE_EXT}}"
go:b:*:
dir: "{{.CORE_DIR}}"
desc: "Builds a Go target. Usage: task go:<target>"
vars:
CMD_NAME: "{{index .MATCH 0}}"
EXE_EXT: '{{if eq OS "windows"}}.exe{{end}}'
DEFAULT_OUT: ../{{.BUILD_DIR}}/{{.CMD_NAME}}
OUT: '{{.OUT| default .DEFAULT_OUT}}'
TAG: '{{.TAG| default }}'
RUN: '{{.RUN| default }}'
DEFAULT_OUT_EXE: '{{.OUT}}/{{.CMD_NAME}}'
OUT_EXE: '{{.OUT_EXE| default .DEFAULT_OUT_EXE}}'
INFO_PACKAGE: "github.com/ra341/glacier/internal/info"
VERSION:
sh: git describe --tags --abbrev=0 2>/dev/null || echo "canary"
COMMIT:
sh: git rev-parse HEAD
BUILD_DATE:
sh: date -u +'%Y-%m-%dT%H:%M:%SZ'
BRANCH:
sh: git rev-parse --abbrev-ref HEAD
LDFLAGS: >-
{{if .STATIC}}-linkmode external -extldflags '-static'{{end}}
{{if .PROD}}-s -w{{end}}
{{if eq .OS "Windows_NT" }}-H=windowsgui{{ end }}
-X {{.INFO_PACKAGE}}.Version={{.VERSION}}
-X {{.INFO_PACKAGE}}.CommitInfo={{.COMMIT}}
-X {{.INFO_PACKAGE}}.BuildDate={{.BUILD_DATE}}
-X {{.INFO_PACKAGE}}.Branch={{.BRANCH}}
GOENV: >-
{{if .WINDOWS}}
CC=x86_64-w64-mingw32-gcc GOOS=windows
{{end}}
sources:
- "**/*.go"
- "go.*"
cmds:
- '{{if eq .OUT_EXE .DEFAULT_OUT_EXE}} {{.CU}} mkdir -p {{.OUT}} {{end}}'
- task syso
- CGO_ENABLED=1 go build {{if .TAG}} -tags {{.TAG}} {{end}} -ldflags "{{.LDFLAGS}}" -v
-o {{ .OUT_EXE }}{{.EXE_EXT}}
./{{.GO_CMD_DIR}}/{{.CMD_NAME}}
- '{{if .RUN}} cd {{.OUT}} && ./{{ .CMD_NAME }}{{.EXE_EXT}} {{end}}'
syso:
dir: "{{.CORE_DIR}}/frost/app/syso"
cmds:
- go generate
ggen:
dir: "{{.CORE_DIR}}"
cmds:
- go generate ./...
icon:
dir: "{{.UI_DIR}}"
vars:
ICON_OUT: '../{{.CORE_DIR}}/frost/app/icon'
PNG_OUT: '{{.ICON_OUT}}/icon.png'
ICO_OUT: '{{.ICON_OUT}}/icon.ico'
SIZE: 48
cmds:
- inkscape static/favicon.svg
--export-type=png --export-filename={{.PNG_OUT}}
--export-width={{.SIZE}} --export-height={{.SIZE}}
- magick {{.PNG_OUT}} {{.ICO_OUT}}
ui:
dir: "{{.UI_DIR}}"
vars:
DEFAULT_FROST: '0'
FROST: '{{.FROST | default .DEFAULT_FROST}}'
cmds:
- 'npm run {{if eq .DEFAULT_FROST .FROST}} build {{else}} buildfrost {{end}}'
ui:b:*:
dir: "{{.UI_DIR}}"
vars:
DEFAULT_FROST: '0'
FROST: '{{.FROST | default .DEFAULT_FROST}}'
BUILD_OUT: "build"
CMD: "{{index .MATCH 0}}"
OUT_DIR: ../{{.CORE_DIR}}/{{.GO_CMD_DIR}}/{{.CMD}}
desc: "Builds ui and copies for embed binary. Usage: task ui:<go cmd target>"
# sources:
# - "**/*.ts"
# - "**/*.tsx"
cmds:
- task ui FROST={{.FROST}}
- '{{.CU}} rm -rf {{.OUT_DIR}}/{{.BUILD_OUT}}'
- '{{.CU}} mkdir -p {{.OUT_DIR}}/{{.BUILD_OUT}}'
- '{{.CU}} cp -rf {{.BUILD_OUT}} {{.OUT_DIR}}/'
sidk:
dir: "website"
cmds:
- docker build . -t glacier-docs:dev
- docker run --rm -p 8082:80 glacier-docs:dev
site:
dir: "website"
cmds:
- npm run start
dk:
desc: "Builds and runs the main dockman image. Usage: task dk"
cmds:
- task dk:r
dk:r:
desc: "Builds and runs the main dockman image for a specific target. Usage: task dk:r:<target>"
cmds:
- task dk:b
- docker run --rm -e TZ=America/New_York
-p 6691:6699
{{.DOCKER_IMG}}
dk:b:
desc: "Builds the main docker image"
cmds:
- docker build -f pkg/docker/Dockerfile . -t {{.DOCKER_IMG}}
cli:
cmds:
- docker compose up trasmission caddy
lcli:*:
vars:
CMD: "{{index .MATCH 0}}"
cmds:
- docker compose up {{.CMD}}
pocket:
cmds:
- docker compose up pocket caddy