-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
66 lines (57 loc) · 1.39 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
version: '3'
vars:
APP: cvm
CGO_ENABLED: 0
GOOS:
sh: go env GOOS
GOARCH:
sh: go env GOARCH
DIST_PATH: dist
BUILD_PATH: "{{.DIST_PATH}}/{{.APP}}_{{.GOOS}}_{{.GOARCH}}"
env:
GIT_COMMIT:
sh: git rev-parse --short HEAD
TIMESTAMP: '{{now | unixEpoch}}'
VERSION: 0.0.0-dev
tasks:
test:
desc: Go tests
cmds:
- go test ./... -cover -v -race ${GO_PACKAGES}
vendor:
desc: Go vendor
sources:
- '**/*.go'
- ./go.sum
cmds:
- go mod vendor
- go mod tidy
vendor_update:
desc: Go vendor update
cmds:
- go get -u ./...
- task: vendor
build:
desc: Generate a development binary
dir: '{{.BUILD_PATH}}'
deps: [ vendor ]
cmds:
- |
CGO_ENABLED={{.CGO_ENABLED}} \
go build \
-mod vendor \
-trimpath \
-ldflags "-s -w -X github.com/Cloudbox/{{.APP}}/build.Version=${VERSION} -X github.com/Cloudbox/{{.APP}}/build.GitCommit=${GIT_COMMIT} -X github.com/Cloudbox/{{.APP}}/build.Timestamp=${TIMESTAMP}" \
../../cmd/{{.APP}}
release:
desc: Generate a release, but don't publish
cmds:
- goreleaser --skip-validate --skip-publish --rm-dist
snapshot:
desc: Generate a snapshot release
cmds:
- goreleaser --snapshot --skip-publish --rm-dist
publish:
desc: Generate a release, and publish
cmds:
- goreleaser --rm-dist