-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
73 lines (61 loc) · 2.21 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
version: '3'
vars:
GIT_BRANCH:
sh: git rev-parse --abbrev-ref HEAD || echo ""
GIT_COMMIT:
sh: git log -n 1 --format=%h || echo ""
GIT_DIRTY:
sh: test -n "`git status --porcelain`" && echo "+CHANGES" || true
tasks:
#
# Boring
#
fmt:
cmds:
- go fmt ./...
lint:
deps: [fmt]
cmds:
- golint ./...
vet:
deps: [fmt]
cmds:
- go vet ./...
bootstrap:
cmds:
- go install -mod vendor github.com/cosmtrek/air
- go install -mod vendor github.com/go-task/task/v3/cmd/task
- go install -mod vendor github.com/mitchellh/gox
- go install -mod vendor gotest.tools/gotestsum
- go generate -tags tools tools/tools.go
#
# Run, test, & bench
#
run:
aliases: [dev]
cmds:
- air
test:
cmds:
- go clean -testcache
- gotestsum --format pkgname -- --cover -mod vendor ./...
bench:
cmds:
- go test --cover -mod vendor -bench . -benchmem ./...
#
# Build
#
buildq:
cmds:
- go build -ldflags "-s -w -X gitlab.com/music-library/music-api/version.GitBranch={{.GIT_BRANCH}} -X gitlab.com/music-library/music-api/version.GitCommit={{.GIT_COMMIT}}" -mod vendor .
builddev:
cmds:
- go build -ldflags "-s -w -X gitlab.com/music-library/music-api/version.GitBranch={{.GIT_BRANCH}} -X gitlab.com/music-library/music-api/version.GitCommit={{.GIT_COMMIT}}" -mod vendor -tags "music-api-dev" -o "bin/music-api-dev.exe" .
builddocker:
deps: [vet]
cmds:
- go build -ldflags "-s -w -X gitlab.com/music-library/music-api/version.GitBranch={{.GIT_BRANCH}} -X gitlab.com/music-library/music-api/version.GitCommit={{.GIT_COMMIT}}" -mod vendor -buildvcs=false -tags "music-api" -o "bin/music-api" .
build:
deps: [vet]
cmds:
- gox -osarch "linux/amd64" -gocmd go -ldflags "-s -w -X gitlab.com/music-library/music-api/version.GitBranch={{.GIT_BRANCH}} -X gitlab.com/music-library/music-api/version.GitCommit={{.GIT_COMMIT}}" -tags "music-api" -output "bin/music-api" .