forked from mikeroll/alertmanager-sentry-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
54 lines (52 loc) · 1.32 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
version: '2'
vars:
NAME: alertmanager-sentry-gateway
VERSION: 0.5.4
COMMIT: {sh: git rev-parse --verify HEAD}
BUILD_FLAGS: -ldflags "-X main.VERSION={{.VERSION}} -X main.COMMIT={{.COMMIT}}"
tasks:
build:
cmds:
- go build .
test:
cmds:
- go vet ./...
- go test -v -coverprofile=cover.out ./...
cover:
deps: [test]
cmds:
- go tool cover -html=cover.out
package:
cmds:
- GOOS={{.OS}} GOARCH={{.ARCH}} go build {{.BUILD_FLAGS}} .
- tar -czf dist/{{.NAME}}_{{.OS}}_{{.ARCH}}.tar.gz {{.NAME}}
- rm -rf {{.NAME}}
dist:
deps: [test]
cmds:
- mkdir -p dist
- task: package
vars: {OS: "linux", ARCH: "amd64"}
- task: package
vars: {OS: "linux", ARCH: "arm64"}
- task: package
vars: {OS: "linux", ARCH: "arm"}
- task: package
vars: {OS: "darwin", ARCH: "amd64"}
container:
deps: [test]
cmds:
- docker build -t paveltumik/{{.NAME}}:latest -t paveltumik/{{.NAME}}:{{.VERSION}}
--build-arg BUILD_FLAGS='{{.BUILD_FLAGS}}' .
publish:
deps: [container]
cmds:
- docker push paveltumik/{{.NAME}}:latest
- docker push paveltumik/{{.NAME}}:{{.VERSION}}
vendor:
cmds:
- go mod tidy
- go mod vendor
clean:
cmds:
- rm -rf {{.NAME}} dist cover.out