-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yaml
83 lines (72 loc) · 2.26 KB
/
Taskfile.yaml
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
version: "3"
dotenv:
- ".env"
tasks:
test:
dotenv:
- ".env.test"
desc: runs tests
cmds:
# - task: db-migrate-apply-test
- |
if [ -z "{{ .CLI_ARGS }}" ]; then
go test -timeout 30s --count=1 -v ./...
else
go test -timeout 30s --count=1 -v -run {{ .CLI_ARGS }}
fi
bench:
dotenv:
- ".env.test"
desc: runs tests
cmds:
# - task: db-migrate-apply-test
- |
if [ -z "{{ .CLI_ARGS }}" ]; then
go test -timeout 30s --count=1 -v -bench=. -benchmem -memprofile tmp/pprof/memory-test.out -cpuprofile tmp/pprof/cpu-test.out ./...
else
go test -timeout 30s --count=1 -v -bench=. -benchmem -memprofile tmp/pprof/memory-test.out -cpuprofile tmp/pprof/cpu-test.out -run {{ .CLI_ARGS }}
fi
generate-db:
desc: generate models from database schema
cmd: go generate ./internal/database
generate-assets:
desc: generate static assets
cmd: go generate ./internal/assets
db-migrate:
desc: generate migrations
cmds:
- echo "Generating migrations for $DATABASE_PATH/$DATABASE_NAME"
- task: db-migrate-hash
- atlas migrate diff --env local
db-migrate-hash:
desc: generate migrations
cmds:
- atlas migrate hash --env local
db-migrate-apply:
desc: apply migrations using atlas
cmds:
# variables will be pulled from global vars declaration unless overwritten in the task call
- echo "Applying migrations to $DATABASE_PATH/$DATABASE_NAME"
- migrate -verbose -path internal/database/migrations -database sqlite3://{{.DATABASE_PATH}}/{{.DATABASE_NAME}}?_fk=1 up
db-migrate-tests:
desc: apply migrations using atlas
dotenv:
- ".env.test"
cmds:
- migrate -verbose -path internal/database/migrations -database sqlite3://{{.DATABASE_PATH}}/{{.DATABASE_NAME}}?_fk=1 up
build-widget:
desc: Build amth-widget js assets
dir: cmd/frontend/widget
cmds:
- bun run build
- rm -rf ../public/js/widget
- mkdir -p ../public/js/widget
- cp dist/components/* ../public/js/widget/
dev:
desc: Start a local dev server
cmds:
- air
dev-web:
desc: Start a local web server for frontend only
cmds:
- air -c .air.web.toml