-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
96 lines (81 loc) · 2.18 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
version: '3'
#includes:
output: prefixed
silent: true
#vars:
env:
ENV: local
tasks:
default:
- task: build
- task: run
build:
desc: Build apps
cmds:
- echo "> Building apps..."
- GOARCH=wasm GOOS=js go build -o web/app.wasm src/*.go
- go build -o build/main src/*.go
- defer: echo "> Build done"
run:
deps: [build]
cmds:
- echo "> Run..."
- ./build/main
- defer: echo "> Run done"
clean:
cmds:
- echo "> Clean..."
- rm -r ./build
- rm -r ./web
- rm -r ./tmp
- rm coverage.out
- defer: echo "> Clean done"
test:
cmds:
- echo "> Testing..."
- go test -coverprofile=coverage.out ./internal/...
- defer: echo "> Testing done"
lint:
cmds:
- golangci-lint run
coverage-html:
deps: [test]
cmds:
- go tool cover -html=coverage.out
coverage:
deps: [test]
cmds:
- go tool cover -func=coverage.out
run-db:
cmds:
- echo "> Running databases..."
- echo "> Starting DynamoDB..."
- docker run --name dynamodb-local -p 8000:8000 -d amazon/dynamodb-local
- echo "> Starting Postgres..."
- docker run --name postgres-local -e POSTGRES_PASSWORD=mysecretpassword -d postgres
- defer: echo "> Running databases done"
stop-db:
cmds:
- echo "> Running databases..."
- echo "> Stoping DynamoDB..."
- docker stop dynamodb-local
- echo "> Removing DynamoDB..."
- docker rm dynamodb-local
- echo "> Stoping Postgres..."
- docker stop postgres-local
- echo "> Removing Postgres..."
- docker rm postgres-local
- defer: echo "> Running databases done"
version:
cmds:
- echo "> Version..."
- mkdir -p ./internal/version
- echo -e 'package version\nconst Version string = "{{.VERSION}}{{.DIRTY}}"\nconst Date string = "{{.DATE}}"' > ./internal/version/version.go
- defer: echo "> Version done"
vars:
VERSION:
sh: 'git log -n 1 --format=%h'
DIRTY:
sh: '[[ $(git status 2> /dev/null | tail -n1) == *"nothing to commit"* ]] || echo "*"'
DATE:
sh: 'date --utc "+%Y-%m-%d %H:%M:%S"'