-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathTaskfile.yml
More file actions
175 lines (150 loc) · 5.58 KB
/
Taskfile.yml
File metadata and controls
175 lines (150 loc) · 5.58 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
version: "3"
tasks:
lint:js:
cmds:
- npx eslint darkstat/front/static_front/custom
test:
cmds:
- task: build-version
- go test ./... {{.CLI_ARGS}}
# -coverprofile=cover.out
# https://github.com/golang/go/issues/75031
vars:
PWD:
sh: echo '$(pwd)'
test:cover:
cmds:
- task: build-version
- go tool cover -html=cover.out
test:cover:total:
cmds:
- task: build-version
- task: test
- go tool cover -func cover.out
build:
cmds:
- task: build-version
- templ generate
- go run . build
web:
cmds:
- task: build-version
- templ generate
# - task: swag:build
- go run . web
dev:templ:
cmds:
- task: build-version
- templ generate -watch --cmd="go run . web"
dev:watch:
cmds:
- task: swag:build
- task: build-version
# pip install watchdog[watchmedo]
- >
~/venv/bin/watchmedo auto-restart
--patterns "*.templ;*.go;*.css;*.js;enverant.json"
-i "*_templ.go"
--recursive
-- sh -c "task web; sleep infinity"
build:test:
cmds:
- task: build-version
- mkdir -p dist
- rm dist/darkstat-linux-amd64 | true
- GOOS=linux GOARCH=amd64 go build -v -o dist/darkstat-linux-amd64 main.go
build:test_windows:
cmds:
- task: build-version
- mkdir -p dist
- rm dist/darkstat-linux-amd64 | true
- GOOS=windows GOARCH=amd64 go build -v -o ~/windows10shared/fl-files-discovery/darkstat.exe main.go
build-version:
cmds:
- autogit semver --publish > darkstat/settings/version.txt || echo 'v0.0.0' > darkstat/settings/version.txt
build:bins_only:
cmds:
- mkdir -p dist
- rm dist/* | true
- GOOS=linux GOARCH=amd64 go build -v -o dist/darkstat-linux-amd64 main.go
- GOOS=linux GOARCH=arm64 go build -v -o dist/darkstat-linux-arm64 main.go
- GOOS=windows GOARCH=amd64 go build -v -o dist/darkstat-windows-amd64.exe main.go
- GOOS=windows GOARCH=arm64 go build -v -o dist/darkstat-windows-arm64.exe main.go
- GOOS=darwin GOARCH=amd64 go build -v -o dist/darkstat-macos-amd64 main.go
- GOOS=darwin GOARCH=arm64 go build -v -o dist/darkstat-macos-arm64 main.go
# We can build for those too, but i don't think they are needed
# - GOOS=linux GOARCH=386 go build -v -o dist/darkstat-linux-386 main.go
# - GOOS=linux GOARCH=arm go build -v -o dist/darkstat-linux-arm main.go
# - GOOS=windows GOARCH=386 go build -v -o dist/darkstat-windows-386.exe main.go
# - GOOS=windows GOARCH=arm go build -v -o dist/darkstat-windows-arm.exe main.go
build:bins:
cmds:
- task: build-version
- task: build:bins_only
- rm dist/* | true
hook:prod:
cmds:
- sudo rm /usr/local/bin/darkstat | true
- GOOS=linux GOARCH=amd64 go build -v -o dist/darkstat-linux-amd64 main.go
- sudo ln -s {{.PWD}}/dist/darkstat-linux-amd64 /usr/local/bin/darkstat
docker:build:
cmds:
- docker build --build-arg "BUILD_VERSION=$tag_version" --tag darkwind8/darkstat:$tag_version .
docker:push:
cmds:
- docker push darkwind8/darkstat:$tag_version
- docker tag darkwind8/darkstat:$tag_version darkwind8/darkstat:staging
- docker push darkwind8/darkstat:staging
- docker pull darkwind8/darkstat:staging && docker service update --image darkwind8/darkstat:staging darkstat-staging
docker:run:
cmds:
- docker run -it darkwind8/darkstat:$tag_version
docker:deploy:
cmds:
- docker tag darkwind8/darkstat:staging darkwind8/darkstat:production
- docker push darkwind8/darkstat:production
- docker pull darkwind8/darkstat:production && docker service update --image darkwind8/darkstat:production darkstat-production
kcl:build:
dir: .github
cmds:
- kcl build.k
swag:build:
cmds:
- rm docs/docs.go | true
- swag init --parseDependency
profiler:cpu:
cmds:
- go tool pprof main.go prof.prof
profiler:mem: # https://www.codingexplorations.com/blog/memory-management-and-profiling-in-go
cmds:
- go tool pprof mem.pprof
lint:
cmds:
- golangci-lint run
profiler:web:
cmds:
# https://www.codereliant.io/memory-leaks-with-pprof/
- go tool pprof -inuse_space -http=":8001" http://localhost:6060/debug/pprof/heap
# go tool pprof -inuse_space -http=":8001" https://darkstat-pprof.dd84ai.com/debug/pprof/heap
# commands like `top`, `web`, `list FunctionName`
# go tool pprof -raw -output=cpu.txt http://localhost:6060/debug/pprof/profile?seconds=5
# with menu go tool pprof -http=":8001" http://localhost:6060/debug/pprof/profile?seconds=5
# go tool pprof -alloc_space -http=":8001" http://localhost:6060/debug/pprof/heap
# go tool pprof -http=":8001" darkstat.pprof
openapi:generate:
cmds:
- sdk use java 11.0.25-sem
- task: swag:build
- java -jar openapi-generator-cli.jar generate -i docs/swagger.yaml -g go -o ../generated_go
# - java -jar openapi-generator-cli.jar generate -i docs/swagger.yaml -g go -o ./darkapi/clientgo
# - java -jar openapi-generator-cli.jar generate -i docs/swagger.yaml -g go-server -o ./darkapi/servergo
#- java -jar openapi-generator-cli.jar list
env:
tag_version: v1.48.0-a4
DOCKER_HOST: ssh://root@darklab:22
# RELAY_HOST: "darkrelay.mydd84ai.com:8080"
# necessary env params for Oauth local development
# DARKCORE_PASSWORD: "1233"
# DARKCORE_SECRET: "passphrasewhichneedstobe32bytes!"
# DARKCORE_DISCO_OAUTH: "true"
# SITE_URL: "darkstat.mydd84ai.com:8000"