-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTaskfile.yml
136 lines (110 loc) · 3.56 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
version: "3"
env:
tag_version: v1.6.11
DOCKER_HOST: ssh://root@darkbot:22
tasks:
build-version:
cmds:
- autogit version > app/settings/version.txt || echo 'not installed autogit' > settings/version.txt
build:
cmds:
- GOOS=linux GOARCH=amd64 go build -v -o main main.go
test:
cmds:
# - go clean -cache ./...
# - go clean -testcache ./...
# -count=1
- go test ./... -coverprofile=cover.out {{.CLI_ARGS}}
env:
AUTOGIT_PROJECT_FOLDER:
sh: echo "$(pwd)"
test:cover:
cmds:
- go tool cover -html=cover.out
test:cover:total:
cmds:
- task: test
- go tool cover -func cover.out
doc-web:
cmds:
- godoc -http=:6060
docker:ps:
cmds:
- docker ps
docker:build:
cmds:
- docker build --tag darkwind8/darkbot:$tag_version .
docker:push:
cmds:
- docker push darkwind8/darkbot:$tag_version
docker:run:
cmds:
- docker run -it darkwind8/darkbot:$tag_version
docker:buildpush:
cmds:
- task: docker:build
- task: docker:push
shell:staging:
cmds:
- ssh -i ~/.ssh/id_rsa.darklab root@5.161.80.45
shell:production:
cmds:
- ssh -i ~/.ssh/id_rsa.darklab root@5.161.54.150
copy_prod_to_stag:
cmds:
- scp -i ~/.ssh/id_rsa.darklab root@5.161.179.34:/var/lib/darklab/darkbot/prod.sqlite3 root@5.161.80.45:/var/lib/darklab/darkbot
- scp -i ~/.ssh/id_rsa.darklab root@5.161.179.34:/var/lib/darklab/darkbot/prod.sqlite3-shm root@5.161.80.45:/var/lib/darklab/darkbot
- scp -i ~/.ssh/id_rsa.darklab root@5.161.179.34:/var/lib/darklab/darkbot/prod.sqlite3-wal root@5.161.80.45:/var/lib/darklab/darkbot
copy_prod_to_local:
cmds:
- scp -i ~/.ssh/id_rsa.darklab root@5.161.179.34:/var/lib/darklab/darkbot/prod.sqlite3 ./data
- scp -i ~/.ssh/id_rsa.darklab root@5.161.179.34:/var/lib/darklab/darkbot/prod.sqlite3-shm ./data
- scp -i ~/.ssh/id_rsa.darklab root@5.161.179.34:/var/lib/darklab/darkbot/prod.sqlite3-wal ./data
copy_local_to_prod:
cmds:
- scp -i ~/.ssh/id_rsa.darklab ./data/prod.sqlite3 root@5.161.54.150:/var/lib/darklab/darkbot/
- scp -i ~/.ssh/id_rsa.darklab ./data/prod.sqlite3-shm root@5.161.54.150:/var/lib/darklab/darkbot/
- scp -i ~/.ssh/id_rsa.darklab ./data/prod.sqlite3-wal root@5.161.54.150:/var/lib/darklab/darkbot/
venv:create:
cmds:
- python3 -m venv .venv
status:
- test -d .venv
venv:install:
cmds:
- .venv/bin/pip install -r requirements.txt -c constraints.txt
status:
- test -f .venv/bin/mkdocs
mkdocs:dev:
cmds:
- task: venv:install
- .venv/bin/mkdocs serve
backup: # /var/lib/darklab/prod/darkbot
cmds: # ssh -i ~/.ssh/id_rsa.darklab root@5.161.179.34
- echo "TODO write command for backup"
profile:run:
cmds:
- go run . run
profile:render:
cmds:
- curl http://localhost:8080/debug/pprof/heap > heap.{{.DATE}}.pprof
- go tool pprof --pdf ~/repos/pet_projects/fl-darkbot/main heap.{{.DATE}}.pprof > file_{{.DATE}}.pdf
- rm heap.{{.DATE}}.pprof
vars:
DATE:
sh: date +%s
profile:render2:
cmds:
- curl http://localhost:8080/debug/pprof/heap > heap.{{.DATE}}.pprof
- go tool pprof --base heap.1675610376.pprof --pdf ~/repos/pet_projects/fl-darkbot/main heap.{{.DATE}}.pprof > file_diff_{{.DATE}}.pdf
- rm heap.{{.DATE}}.pprof
vars:
DATE:
sh: date +%s
profile:render3:
cmds:
- task: profile:render
- task: profile:render2
kcl:build:
cmds:
- kcl kcls/build.k