-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
89 lines (75 loc) · 2.56 KB
/
Copy pathmise.toml
File metadata and controls
89 lines (75 loc) · 2.56 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
84
85
86
87
88
89
[tools]
golangci-lint = "latest"
typos = "latest"
vhs = "latest"
"aqua:charmbracelet/freeze" = "latest"
fd = "latest"
"go:go.uber.org/nilaway/cmd/nilaway" = "latest"
"go:golang.org/x/pkgsite/cmd/pkgsite" = "latest"
[vars]
COV_DATA = "coverage.out"
[tasks.tidy]
description = "Tidy dependencies in go.mod and go.sum"
run = "go mod tidy"
sources = ["**/*.go", "go.mod", "go.sum"]
[tasks.fmt]
description = "Run go fmt on all source files"
run = "golangci-lint fmt ./..."
sources = ["**/*.go", ".golangci.yml", "**/*.md"]
[tasks.test]
description = "Run the test suite"
# -race needs CGO (https://go.dev/doc/articles/race_detector#Requirements)
env = { CGO_ENABLED = "1" }
run = "go test -race ./..."
sources = ["**/*.go", "**/testdata/**/*", "go.mod", "go.sum"]
[tasks.bench]
description = "Run all project benchmarks"
run = "go test ./... -run None -benchmem -bench ."
sources = ["**/*.go"]
[tasks.lint]
description = "Run the linters and auto-fix if possible"
depends = ["fmt"]
run = ["golangci-lint run --fix", "typos", "nilaway ./..."]
sources = ["**/*.go", ".golangci.yml"]
[tasks.docs]
description = "Render the pkg docs locally"
raw = true
run = "pkgsite -open"
[tasks.demo]
description = "Render the demo gifs"
run = [
'for file in ./docs/src/*.tape; do vhs "$file" & done; wait',
"freeze ./examples/cover/main.go --config ./docs/src/freeze.json --output .assets/demo.png --show-line-numbers",
]
sources = ["./docs/src/*.tape", "**/*.go"]
outputs = [".assets/*.gif", ".assets/demo.png"]
[tasks.upload]
description = "Upload the demo gifs to my personal CDN. (Requires AWS auth)"
depends = "demo"
sources = [".assets/*.gif", ".assets/*.png"]
run = "aws s3 cp .assets/ s3://assets.followtheprocess.codes/projects/cli/ --recursive --sse AES256"
[tasks.cov]
description = "Calculate test coverage (pass --open to view as HTML in a browser)"
usage = '''
flag "--open" help="Open the coverage report in a browser"
'''
run = '''
go test -race -cover -covermode atomic -coverprofile {{vars.COV_DATA}} ./...
if [ "${usage_open:-false}" = "true" ]; then
go tool cover -html {{vars.COV_DATA}}
fi
'''
sources = ["**/*.go", "**/testdata/**/*", "go.mod", "go.sum"]
outputs = ["{{vars.COV_DATA}}"]
[tasks.check]
description = "Run tests and linting in one"
depends = ["test", "lint"]
[tasks.sloc]
description = "Print lines of code"
run = "fd . -e go | xargs wc -l | sort -nr | head"
[tasks.clean]
description = "Remove build artifacts and other clutter"
run = ["go clean ./...", "rm -rf *.out"]
[tasks.update]
description = "Updates dependencies in go.mod and go.sum"
run = ["go get -u ./...", "go mod tidy"]