-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
83 lines (69 loc) · 1.7 KB
/
Copy pathTaskfile.yml
File metadata and controls
83 lines (69 loc) · 1.7 KB
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
75
76
77
78
79
80
81
82
83
version: "3"
vars:
BINARY: prutil
MAIN: ./cmd/prutil
BIN_DIR: bin
VERSION:
sh: git describe --tags --always --dirty 2>/dev/null || echo dev
LDFLAGS: -s -w -X main.version={{.VERSION}}
env:
# prutil targets Go 1.26; let the go command fetch that toolchain when the
# installed one is older.
GOTOOLCHAIN: auto
tasks:
default:
desc: Run the standard checks (fmt, vet, lint, test)
cmds:
- task: check
tidy:
desc: Sync go.mod and go.sum
cmds:
- go mod tidy
fmt:
desc: Format the code
cmds:
- gofmt -w .
vet:
desc: Run go vet
cmds:
- go vet ./...
lint:
desc: Run golangci-lint
cmds:
- golangci-lint run
test:
desc: Run the unit tests with the race detector
cmds:
- go test -race ./...
cover:
desc: Run the tests and report coverage per function
cmds:
- go test -race -coverprofile=coverage.out ./...
- go tool cover -func=coverage.out
check:
desc: Format, vet, lint and test
cmds:
- task: fmt
- task: vet
- task: lint
- task: test
build:
desc: Build the binary into ./bin
cmds:
- mkdir -p {{.BIN_DIR}}
- go build -trimpath -ldflags "{{.LDFLAGS}}" -o {{.BIN_DIR}}/{{.BINARY}} {{.MAIN}}
run:
desc: Build and run prutil against your gh credentials
cmds:
- go run -ldflags "{{.LDFLAGS}}" {{.MAIN}} {{.CLI_ARGS}}
install:
desc: Tidy, format, vet, lint, test, build and install prutil into GOBIN
cmds:
- task: tidy
- task: check
- task: build
- go install -trimpath -ldflags "{{.LDFLAGS}}" {{.MAIN}}
clean:
desc: Remove build output
cmds:
- rm -rf {{.BIN_DIR}} coverage.out