Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
84 lines (72 loc) · 1.68 KB
/
Copy pathTaskfile.yml
File metadata and controls
84 lines (72 loc) · 1.68 KB
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
version: '3'
vars:
APP: autoscan
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:
lint:
desc: Run golangci-lint
cmds:
- go tool golangci-lint run ./...
lint:fmt:
desc: Run golangci-lint formatters
cmds:
- go tool golangci-lint fmt ./...
lint:fix:
desc: Run golangci-lint with auto-fix then reformat
cmds:
- go tool golangci-lint run --fix ./...
- go tool golangci-lint fmt ./...
test:
desc: Go tests
cmds:
- go test ./... -cover -v -race ${GO_PACKAGES}
vendor:
desc: Go vendor
sources:
- '**/*.go'
- ./go.sum
generates:
- vendor/modules.txt
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 main.Version=${VERSION} -X main.GitCommit=${GIT_COMMIT} -X main.Timestamp=${TIMESTAMP}" \
../../cmd/{{.APP}}
release:
desc: Generate a release, but don't publish
cmds:
- goreleaser --skip=validate,publish --clean
snapshot:
desc: Generate a snapshot release
cmds:
- goreleaser --snapshot --skip=publish --clean
publish:
desc: Generate a release, and publish
cmds:
- goreleaser --clean