-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
39 lines (33 loc) · 1.29 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
version: "3"
vars:
HASH: { sh: git rev-parse --short HEAD }
BRANCH: { sh: git rev-parse --abbrev-ref HEAD }
BINARY_PATH: ./bin/main
tasks:
tools:
env:
FILE: ".git/hooks/pre-commit"
cmds:
- command -v golangci-lint 2>/dev/null || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.3
- command -v air 2>/dev/null || curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s -- -b "$(go env GOPATH)"/bin
- command -v mockgen 2>/dev/null || go install go.uber.org/mock/mockgen@latest
- command -v gomodifytags 2>/dev/null || go install -v github.com/fatih/gomodifytags@latest
- command -v gotestsum 2>/dev/null || go install gotest.tools/gotestsum@latest
- cp .github/pre-commit.sh $FILE
- chmod +x $FILE
- test -f $FILE && echo "$FILE exists."
generate:
cmds:
- go generate ./...
analysis:
deps: [generate]
cmds:
- golangci-lint run --new-from-rev HEAD~ ./...
unit_tests:
deps: [generate]
cmds:
- gotestsum --hide-summary=skipped --max-fails=1 ./...
build:
deps: [generate]
cmds:
- CGO_ENABLED=0 go build -ldflags "-X main.Version={{.HASH}} -X main.Hash={{.HASH}}" -a -o {{.BINARY_PATH}} .