forked from abhinav/git-spice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
189 lines (159 loc) · 5.27 KB
/
Copy pathmise.toml
File metadata and controls
189 lines (159 loc) · 5.27 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
[settings]
experimental = true
[env]
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.
# https://github.com/gotestyourself/gotestsum/pull/568
"github:abhinav/gotestsum" = "v1.14.0-beta.1+github-actions-fails"
# 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"
usage = '''
flag "--race" default="false" help="Enable data race detection"
flag "--format <format>" default="standard-verbose" help="gotestsum output format"
'''
run = "gotestsum --format={{usage.format}} -- ./... -race={{usage.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 "--format <format>" default="standard-verbose" help="gotestsum output format"
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>" default="" help="Regex to select which script tests to run"
complete "script" run="ls testdata/script/*.txt | cut -d/ -f3 | sed 's/.txt$//'"
'''
run = """
gotestsum --format={{usage.format}} -- {# -#}
-tags=script {# enable script tests -#}
-run TestScript/{{usage.run|quote}} {# run only script tests -#}
-count {{usage.count}} {# number of times to run tests -#}
-race={{usage.race}} {# race detection -#}
-shard-index={{usage.shard_index}} {# shard index -#}
-shard-count={{usage.shard_count}} {# shard count -#}
-update={{usage.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"
usage = '''
flag "--race" default="false" help="Enable data race detection"
flag "--format <format>" default="standard-verbose" help="gotestsum output format"
'''
run = """
gotestsum --format={{usage.format}} -- {# -#}
./... {# run all tests -#}
-race={{usage.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"
usage = '''
flag "--race" default="false" help="Enable data race detection"
flag "--format <format>" default="standard-verbose" help="gotestsum output format"
flag "--shard-index <shard_index>" default="0" help="Shard index to run"
flag "--shard-count <shard_count>" default="1" help="Total number of shards"
'''
run = """
gotestsum --format={{usage.format}} -- {# -#}
-tags=script {# enable script tests -#}
-run '^TestScript$' {# run only script tests -#}
-race={{usage.race}} {# race detection -#}
-coverpkg=./... {# cover all packages -#}
-coverprofile=cover.out {# -#}
-shard-index={{usage.shard_index}} {# shard index -#}
-shard-count={{usage.shard_count}} {# shard count -#}
"""
[tasks.tidy]
run = "go mod tidy"
description = "Update go.mod and go.sum files"
[tasks.fmt]
run = "golangci-lint fmt"
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 usage.pprof -%}
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"
usage = '''
arg "<version>" help="Version to prepare"
'''
run = "go run ./tools/ci/prepare-release -version {{usage.version}}"