-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathTaskfile.yml
56 lines (54 loc) · 1.46 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
version: '2'
vars:
NAME: cloudevents-webhook-gateway
VERSION: 0.11.0
COMMIT: {sh: git rev-parse --verify HEAD}
BUILD_FLAGS: -ldflags "-X main.VERSION={{.VERSION}} -X main.COMMIT={{.COMMIT}}"
tasks:
build:
deps: [test]
cmds:
- CGO_ENABLED=0 go build {{.BUILD_FLAGS}} .
test:
cmds:
- go vet ./...
- go test -v -coverprofile=cover.out ./...
cover:
deps: [test]
cmds:
- go tool cover -html=cover.out
build-container:
deps: [test]
cmds:
- GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build {{.BUILD_FLAGS}} .
- docker build -t summerwind/{{.NAME}}:latest -t summerwind/{{.NAME}}:{{.VERSION}} .
push-container:
cmds:
- docker push summerwind/{{.NAME}}:latest
push-release-container:
cmds:
- docker push summerwind/{{.NAME}}:{{.VERSION}}
package:
cmds:
- GOOS={{.OS}} GOARCH={{.ARCH}} CGO_ENABLED=0 go build {{.BUILD_FLAGS}} .
- tar -czf release/{{.NAME}}_{{.OS}}_{{.ARCH}}.tar.gz {{.NAME}}
- rm -rf {{.NAME}}
release:
deps: [test]
cmds:
- mkdir -p release
- 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"}
github-release:
deps: [release]
cmds:
- ghr v{{.VERSION}} release/
clean:
cmds:
- rm -rf {{.NAME}} dist cover.out