-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmise.toml
More file actions
131 lines (111 loc) · 3.15 KB
/
mise.toml
File metadata and controls
131 lines (111 loc) · 3.15 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
[env]
GOBIN = "{{ config_root }}/bin"
_.path = ["bin"]
PROJECT_ROOT = "{{ config_root }}"
[tools]
go = "latest"
"aqua:golangci/golangci-lint" = "latest"
"ubi:miniscruff/changie" = "latest"
gofumpt = "latest"
node = "lts"
"ubi:abhinav/requiredfield" = "latest"
[tasks.all]
description = "Build, lint and test the code."
depends = ["build", "lint", "test"]
[tasks.build]
run = "go install go.abhg.dev/doc2go"
description = "Build the project"
[tasks.lint]
description = "Run all linters"
depends = ["lint:*"]
[tasks.test]
description = "Run all tests"
depends = ["test:*"]
[tasks.cover]
description = "Run all tests with coverage"
depends = ["cover:*"]
[tasks."test:unit"]
description = "Run unit tests"
run = "go test -race ./..."
[tasks."test:integration"]
description = "Run integration tests"
depends = ["tools"]
usage = '''
flag "--run <run>" help="Regex to select which script tests to run" default="."
'''
run = """
GOBIN=$(mktemp -d)
GOBIN=$GOBIN go install -race go.abhg.dev/doc2go
PATH=$GOBIN:$PATH \
go -C integration test ./... \
-doc2go $GOBIN/doc2go \
-pagefind {{ config_root }}/integration/node_modules/.bin/pagefind \
-rundir {{ config_root }} \
-run "$usage_run"
"""
[tasks.tools]
description = "Install tools"
depends = ["tools:*"]
[tasks.errtrace]
description = "Run errtrace"
depends = ["tools:go"]
run = """
errtrace -w ./...
(cd integration && errtrace -w ./...)
"""
[tasks."cover:unit"]
description = "Run tests with coverage"
run = [
"go test -coverprofile=cover.out -coverpkg=./... ./...",
"go tool cover -html=cover.out -o cover.html"
]
[tasks."cover:integration"]
description = "Run tests with coverage and generate HTML report"
depends = ["tools"]
run = """
GOBIN=$(mktemp -d)
GOCOVERDIR=$(mktemp -d)
GOBIN=$GOBIN go install -race -cover -coverpkg=./... go.abhg.dev/doc2go
GOCOVERDIR=$GOCOVERDIR PATH=$GOBIN:$PATH \
go test -C integration ./... \
-doc2go $GOBIN/doc2go \
-pagefind {{ config_root }}/integration/node_modules/.bin/pagefind \
-rundir {{ config_root }}
go tool covdata textfmt -i=$GOCOVERDIR -o=cover.integration.out
go tool cover -html=cover.integration.out -o cover.integration.html
"""
[tasks."lint:tidy"]
description = "Ensure go.mod is tidy"
run = "go mod tidy -diff"
[tasks."lint:golangci"]
description = "Run golangci-lint"
run = "golangci-lint run"
[tasks."lint:requiredfield"]
run = "go vet -vettool=$(command -v requiredfield) ./..."
description = "Check for required fields"
[tasks."lint:errtrace"]
description = "Run errtrace"
depends = ["tools:go"]
run = """
LOG=$(mktemp)
errtrace -l ./.. | sed -e 's|^|./|g' >> "$LOG"
(cd integration && errtrace -l ./.. | sed -e 's|^|./|g') >> "$LOG"
if [ -s "$LOG" ]; then
echo "Errtrace found errors:"
cat "$LOG"
echo "Run 'mise run errtrace' to fix them."
false
fi
"""
[tasks."changes:new"]
description = "Add a changelog entry"
run = "changie new"
[tasks."changes:prepare"]
description = "Prepare the changelog for release"
run = 'changie batch {{arg(name="version")}} && changie merge'
[tasks."tools:go"]
description = "Install Go tools"
run = "go install tool"
[tasks."tools:node"]
description = "Install Node tools"
run = "cd integration && npm install"