-
Notifications
You must be signed in to change notification settings - Fork 3
/
taskfile.yml
74 lines (70 loc) · 2.25 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
74
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: '3'
vars:
OWNER: dnitsch
NAME: reststrategy
GIT_TAG: "0.9.0"
VERSION: "v{{ .GIT_TAG}}"
REVISION: aaaabbbb1234
LDFLAGS: -ldflags="-s -w -X \"github.com/{{ .OWNER}}/{{ .NAME }}/seeder/cmd/strategyrestseeder.Version={{ .VERSION}}\" -X \"github.com/{{ .OWNER}}/{{ .NAME }}/seeder/cmd/strategyrestseeder.Revision={{ .REVISION }}\" -extldflags -static"
tasks:
clean:
desc: cleans output dir
dir: '{{ .DIR }}'
cmds:
- rm -rf bin/*
- rm -rf dist/*
- rm -rf vendor/*
- mkdir -p dist
requires:
vars:
- DIR
build-seeder:
dir: seeder
cmds:
- |
go mod tidy
- task: clean
vars:
DIR: seeder
- cmd: |
for os in darwin linux windows; do
GOOS=${os} CGO_ENABLED=0 go build -mod=readonly -buildvcs=false {{ .LDFLAGS }} -o dist/seeder-${os} ./cmd;
done
test-seeder:
dir: seeder
cmds:
- |
mkdir -p .coverage
go install github.com/jstemmer/go-junit-report/v2@latest && \
go install github.com/axw/gocov/gocov@latest && \
go install github.com/AlekSi/gocov-xml@latest
- |
go test ./... -v -buildvcs=false -mod=readonly -coverprofile=.coverage/out > .coverage/unit
cat .coverage/unit | go-junit-report > .coverage/report-junit.xml
gocov convert .coverage/out | gocov-xml > .coverage/report-cobertura.xml
show_coverage:
desc: Shows coverage summary in default browser
dir: seeder
deps:
- test-seeder
cmds:
- go tool cover -html=.coverage/out
publish-seeder:
dir: seeder
cmds:
- cmd: |
git tag -a {{ .VERSION }} -m "ci tag release reststrategy" {{ .REVISION }}
# git tag -a apis/{{ .VERSION }} -m "ci tag release reststrategy/apis" {{ .REVISION }}
git tag -a seeder/{{ .VERSION }} -m "ci tag release reststrategy/seeder" {{ .REVISION }}
git push origin --tags
- |
OWNER={{ .OWNER }} NAME={{ .NAME }} PAT={{ .PAT }} VERSION={{ .VERSION }} ./hack/release.sh
vars:
OWNER: '{{ .OWNER }}'
NAME: '{{ .NAME }}'
GIT_TAG: '{{ .GIT_TAG }}'
requires:
vars:
- PAT
- GIT_TAG