| 1 |
[settings] |
| 2 |
lockfile = true # DO NOT FORGET TO `touch mise.lock` if mise.lock does not exist! |
| 3 |
|
| 4 |
|
| 5 |
[tools] |
| 6 |
go = ['latest', '1.26'] |
| 7 |
|
| 8 |
#--- Format |
| 9 |
# Opinionated Code Formatter. |
| 10 |
prettier = 'latest' |
| 11 |
|
| 12 |
#--- Lint |
| 13 |
# Static checker for GitHub Actions workflow files. |
| 14 |
actionlint = 'latest' |
| 15 |
# Fast linters runner for Go. |
| 16 |
golangci-lint = 'latest' |
| 17 |
|
| 18 |
#--- Test |
| 19 |
# 'go test' runner with output optimized for humans. |
| 20 |
gotestsum = 'latest' |
| 21 |
|
| 22 |
#--- Release |
| 23 |
# A highly customizable Changelog Generator that follows Conventional Commit specifications. |
| 24 |
git-cliff = 'latest' |
| 25 |
# GitHub's official command line tool. |
| 26 |
gh = 'latest' |
| 27 |
|
| 28 |
|
| 29 |
[vars] |
| 30 |
cover = '.cache/cover.out' |
| 31 |
|
| 32 |
|
| 33 |
[tasks.'changelog:skip-commit'] |
| 34 |
description = 'Add commit hash to .cliffignore to exclude from CHANGELOG' |
| 35 |
usage = 'arg "<commit>" help="Git revision (e.g. HEAD or a1b2c4d)"' |
| 36 |
run = 'git rev-parse --verify "${usage_commit}" >> .cliffignore' |
| 37 |
|
| 38 |
[tasks.fmt] |
| 39 |
description = 'Format all files' |
| 40 |
depends = ['fmt:*'] |
| 41 |
|
| 42 |
[tasks.lint] |
| 43 |
description = 'Run all linters' |
| 44 |
depends = ['lint:*'] |
| 45 |
|
| 46 |
[tasks.test] |
| 47 |
description = 'Run all tests' |
| 48 |
depends = ['test:*'] |
| 49 |
|
| 50 |
[tasks.default] |
| 51 |
description = 'Run all formatters, linters and tests' |
| 52 |
depends = ['fmt', 'lint', 'test'] |
| 53 |
|
| 54 |
[tasks.ci] |
| 55 |
description = 'Run all CI tasks' |
| 56 |
depends = ['fmt', 'lint', 'test'] |
| 57 |
# Is working tree clean after fmt? |
| 58 |
run = '! git status --porcelain | tee /dev/stderr | grep -q .' |
| 59 |
run_windows = 'powershell -c "$status = git status --porcelain; if ($status) { $status; exit 1 }"' |
| 60 |
|
| 61 |
[tasks.'fmt:markdown'] |
| 62 |
description = 'Format markdown files' |
| 63 |
sources = ['**/*.md'] |
| 64 |
run = 'prettier --write "**/*.md"' |
| 65 |
|
| 66 |
[tasks.'fmt:go'] |
| 67 |
description = 'Format Go code' |
| 68 |
run = 'golangci-lint fmt' |
| 69 |
|
| 70 |
[tasks.'lint:workflows'] |
| 71 |
description = 'Lint GitHub Action workflows' |
| 72 |
run = 'actionlint' |
| 73 |
|
| 74 |
[tasks.'lint:markdown'] |
| 75 |
description = 'Lint markdown files' |
| 76 |
wait_for = ['fmt:markdown'] |
| 77 |
sources = ['**/*.md'] |
| 78 |
run = 'prettier --check "**/*.md"' |
| 79 |
|
| 80 |
[tasks.'lint:go'] |
| 81 |
description = 'Lint Go files' |
| 82 |
# golangci-lint 2.12.2 (built with go1.26.2) fails to typecheck against the |
| 83 |
# go1.27 GOROOT (e.g. internal/poll/splice_linux.go), so pin go1.26 here until |
| 84 |
# golangci-lint is upgraded to a version that supports go1.27. |
| 85 |
tools = { go = '1.26' } |
| 86 |
run = 'golangci-lint run' |
| 87 |
|
| 88 |
[tasks.'lint:go-compile-windows'] |
| 89 |
description = 'Check Go test compiles on Windows' |
| 90 |
run = 'GOOS=windows go test -c -o /dev/null ./...' |
| 91 |
|
| 92 |
[tasks.'test:go'] |
| 93 |
description = 'Run Go tests for a whole project' |
| 94 |
wait_for = ['lint:*'] # Avoid interleaved output with linters. |
| 95 |
run = 'gotestsum -- -race -timeout=60s ./...' |
| 96 |
|
| 97 |
[tasks.'test:go-1_26'] |
| 98 |
description = 'Run Go tests for a whole project using the oldest supported Go version' |
| 99 |
wait_for = ['lint:*'] |
| 100 |
tools = { go = '1.26' } |
| 101 |
run = 'gotestsum -- -race -timeout=60s ./...' |
| 102 |
|
| 103 |
[tasks.'test:go-submodule'] |
| 104 |
description = 'Run Go tests in the test/ submodule' |
| 105 |
wait_for = ['lint:*'] |
| 106 |
run = 'cd test && gotestsum -- -race -timeout=60s ./...' |
| 107 |
|
| 108 |
[tasks.'test:go-submodule-1_26'] |
| 109 |
description = 'Run Go tests in the test/ submodule using the oldest supported Go version' |
| 110 |
wait_for = ['lint:*'] |
| 111 |
tools = { go = '1.26' } |
| 112 |
run = 'cd test && gotestsum -- -race -timeout=60s ./...' |
| 113 |
|
| 114 |
[tasks.'cover:go:total'] |
| 115 |
description = 'Show Go test coverage total' |
| 116 |
depends = 'cover:go:generate' |
| 117 |
run = 'go tool cover -func={{vars.cover}} | tail -n 1 | xargs echo' |
| 118 |
|
| 119 |
[tasks.'cover:go:browse'] |
| 120 |
description = 'Show Go test coverage in a browser' |
| 121 |
depends = 'cover:go:generate' |
| 122 |
run = 'go tool cover -html={{vars.cover}}' |
| 123 |
|
| 124 |
[tasks.'cover:go:generate'] |
| 125 |
hide = true |
| 126 |
depends = 'cachedir' |
| 127 |
sources = ['**/*.go'] |
| 128 |
outputs = ['{{vars.cover}}'] |
| 129 |
run = ''' |
| 130 |
gotestsum -- \ |
| 131 |
-coverpkg="$(go list ./... | paste -s -d,)" \ |
| 132 |
-coverprofile {{vars.cover}} \ |
| 133 |
./... |
| 134 |
go tool cover -html={{vars.cover}} -o {{vars.cover}}.html |
| 135 |
''' |
| 136 |
|
| 137 |
[tasks.cachedir] |
| 138 |
hide = true |
| 139 |
run = 'mkdir -p .cache' |