-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
66 lines (57 loc) · 1.57 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
env:
TAG_NAME:
sh: |
# check if the current branch is main
if [ "$(git rev-parse --abbrev-ref HEAD)" = "main" ]; then
# if the current branch is main, then use the version as is
cat .version
else
# if the current branch is not main, then append the branch hash to the version
cat .version | git rev-parse --short HEAD
fi
tasks:
dev-setup:
desc: "Setup development environment"
cmds:
- go install golang.org/x/tools/cmd/goimports@latest
- go install github.com/golangci/golangci-lint/cmd/[email protected]
- go install github.com/nikolaydubina/go-cover-treemap@latest
deps:
desc: "Dependencies Check"
cmds:
- go mod download
- go mod tidy
- go mod verify
- go mod vendor
fmt:
desc: "Format Check"
cmds:
- goimports -w -e $(find . -type f -name '*.go' -not -path "*/vendor/*")
lint:
desc: "Lint Check"
cmds:
- golangci-lint run --fix
- go vet ./...
gen:
cmds:
- go generate ./...
desc: Run go generate on the project
test:
desc: "Running unit Tests"
cmds:
- go test -coverprofile cover.out ./...
- go tool cover -html=cover.out -o cover.html
- go-cover-treemap -coverprofile cover.out > assets/cover-treemap.svg
tag:
desc: "Tagging the release"
cmds:
- git tag -a {{.TAG_NAME}} -m "Release {{.TAG_NAME}}"
- git push origin {{.TAG_NAME}}
pr-check:
desc: "PR Check"
cmds:
- task deps
- task fmt
- task lint
- task test