-
-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathmise.toml
More file actions
175 lines (145 loc) · 4.58 KB
/
mise.toml
File metadata and controls
175 lines (145 loc) · 4.58 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
[settings]
experimental = true
[env]
GOTESTSUM_FORMAT = "testname"
GOBIN = "{{ config_root }}/bin"
PROJECT_ROOT = "{{ config_root }}"
_.path = ["{{ config_root }}/bin"]
[tool_alias]
# Specify sources for all tools so we can refer to them directly.
golangci-lint = "aqua:golangci/golangci-lint"
changie = "github:miniscruff/changie"
requiredfield = "github:abhinav/requiredfield"
[tools]
# Self-explanatory.
go = "latest"
# Test runner with prettier output.
gotestsum = "latest"
# Stricter code formatting.
gofumpt = "latest"
# Collection of linters.
golangci-lint = "latest"
# Changelog manager.
changie = "latest"
requiredfield = "0.9.0"
[tasks.generate]
depends = ["tools"]
description = "Update generated code"
run = [
"go generate -x ./...",
"(cd doc && mise run generate)",
]
[tasks.test]
depends = ["test:*"]
[tasks."test:default"]
wait_for = ["generate"]
description = "Run default tests"
run = "gotestsum -- ./... -race={{flag(name='race')}}"
[tasks."test:script"]
wait_for = ["generate"]
description = "Run script tests"
usage = '''
flag "-v --verbose" default="false" help="Enable verbose output"
flag "--race" default="false" help="Enable data race detection"
flag "--update" default="false" help="Update expected results"
flag "--count <count>" default="1" help="Number of times to run tests"
flag "--shard-index <shard_index>" default="0" help="Shard index to run"
flag "--shard-count <shard_count>" default="1" help="Total number of shards"
flag "--run <script>" help="Regex to select which script tests to run"
complete "script" run="ls testdata/script/*.txt | cut -d/ -f3 | sed 's/.txt$//'"
'''
run = """
gotestsum
{%- if flag(name='verbose') == 'true' %} --format=standard-verbose
{%- endif %} -- {# -#}
-tags=script {# enable script tests -#}
-run TestScript/{{option(name='run')}} {# run only script tests -#}
-count {{option(name='count')}} {# number of times to run tests -#}
-race={{flag(name='race')}} {# race detection -#}
-shard-index={{option(name='shard-index')}} {# shard index -#}
-shard-count={{option(name='shard-count')}} {# shard count -#}
-update={{flag(name='update')}} {# update expected results -#}
"""
[tasks."_cover_report"]
run = "go tool cover -html=cover.out -o cover.html"
[tasks."cover:default"]
wait_for = ["generate"]
depends_post = ["_cover_report"]
description = "Run default tests with coverage"
run = """
gotestsum -- {# -#}
./... {# run all tests -#}
-race={{flag(name='race')}} {# race detection -#}
-coverpkg=./... {# cover all packages -#}
-coverprofile=cover.out {# -#}
"""
[tasks."cover:script"]
wait_for = ["generate"]
depends_post = ["_cover_report"]
description = "Run script tests with coverage"
run = """
gotestsum -- {# -#}
-tags=script {# enable script tests -#}
-run '^TestScript$' {# run only script tests -#}
-race={{flag(name='race')}} {# race detection -#}
-coverpkg=./... {# cover all packages -#}
-coverprofile=cover.out {# -#}
-shard-index={{option(name='shard-index', default='0')}} {# shard index -#}
-shard-count={{option(name='shard-count', default='1')}} {# shard count -#}
"""
[tasks.tidy]
run = "go mod tidy"
description = "Update go.mod and go.sum files"
[tasks.fmt]
run = "gofumpt -w ."
description = "Format all go files"
[tasks.lint]
depends = ["lint:*"]
wait_for = ["generate"]
description = "Run all lint checks"
[tasks."lint:golangci-lint"]
run = "golangci-lint run"
description = "Run golangci-lint"
[tasks."lint:requiredfield"]
run = "go vet -vettool=$(command -v requiredfield) ./..."
description = "Check for required fields"
[tasks."lint:tidy"]
run = "go mod tidy -diff"
description = "Ensure go.mod and go.sum are up to date"
[tasks."lint:gofix"]
run = "go fix -diff ./..."
description = "Check for necessary fixes"
[tasks.gofix]
run = "go fix ./..."
description = "Apply go fix to all packages"
[tasks.build]
usage = """
flag "--pprof" help="Build with pofiling flags"
"""
run = """
go build -o bin/git-spice -tags="
{%- if flag(name='pprof') == 'true' -%}
profile
{%- endif -%}
" go.abhg.dev/gs
ln -sf git-spice {{ config_root }}/bin/gs
"""
wait_for = ["generate"]
description = "Build the git-spice binary"
[tasks.tools]
sources = ["go.mod"]
outputs = { auto = true }
run = "go install tool"
description = "Install tools"
hide = true
[tasks.changie]
run = "changie"
description = "Convenience alias to run changie"
[tasks."doc:serve"]
run = "cd doc && mise run serve"
description = "Serve the documentation"
[tasks."doc:build"]
run = "cd doc && mise run build"
[tasks."release:prepare"]
description = "Prepare a release for publishing"
run = "go run ./tools/ci/prepare-release -version {{arg(name='version')}}"