-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
43 lines (37 loc) · 1.02 KB
/
Copy pathTaskfile.yml
File metadata and controls
43 lines (37 loc) · 1.02 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
version: "3"
tasks:
build:
desc: Build all packages
cmds:
- go build ./...
vet:
desc: Run go vet
cmds:
- go vet ./...
lint:
desc: Run gofmt, go vet, and golangci-lint
cmds:
- gofmt -l .
- go vet ./...
- golangci-lint run
fmt:
desc: Apply gofmt and goimports
cmds:
- gofmt -w .
- goimports -w -local github.com/fireline-security .
test:
desc: Run tests
cmds:
- go test ./... -race
coverage:
desc: Run tests with coverage instrumentation, print a per-package summary, and fail below an 85% minimum
cmds:
- |
set -e
go test ./... -race -coverpkg=./... -coverprofile=coverage.out
go tool cover -func=coverage.out
pct=$(go tool cover -func=coverage.out | tail -1 | awk '{print $NF}' | tr -d '%')
awk -v p="$pct" 'BEGIN {
if (p + 0 < 85) { printf "coverage %.1f%% is below the 85%% minimum\n", p; exit 1 }
printf "coverage %.1f%% meets the 85%% minimum\n", p
}'