|
| 1 | +# https://mise.jdx.dev |
| 2 | +[tools] |
| 3 | +golangci-lint = "latest" |
| 4 | +typos = "latest" |
| 5 | +vhs = "latest" |
| 6 | +"go:golang.org/x/pkgsite/cmd/pkgsite" = "latest" |
| 7 | + |
| 8 | +[vars] |
| 9 | +cov_data = "coverage.out" |
| 10 | + |
| 11 | +[tasks.tidy] |
| 12 | +description = "Tidy dependencies in go.mod and go.sum" |
| 13 | +sources = ["**/*.go", "go.mod", "go.sum"] |
| 14 | +run = "go mod tidy" |
| 15 | + |
| 16 | +[tasks.fmt] |
| 17 | +description = "Run go fmt on all source files" |
| 18 | +sources = ["**/*.go", ".golangci.yml"] |
| 19 | +run = "golangci-lint fmt ./..." |
| 20 | + |
| 21 | +[tasks.demo] |
| 22 | +description = "Render the demo gifs" |
| 23 | +sources = ["docs/src/*.tape", "**/*.go"] |
| 24 | +run = 'for file in ./docs/src/*.tape; do vhs "$file"; done' |
| 25 | + |
| 26 | +[tasks.test] |
| 27 | +description = "Run the test suite" |
| 28 | +sources = ["**/*.go", "go.mod", "go.sum", "**/testdata/**/*"] |
| 29 | +# -race needs CGO |
| 30 | +env = { CGO_ENABLED = "1" } |
| 31 | +run = "go test -race ./..." |
| 32 | + |
| 33 | +[tasks.bench] |
| 34 | +description = "Run all project benchmarks" |
| 35 | +sources = ["**/*.go"] |
| 36 | +run = "go test ./... -run None -benchmem -bench ." |
| 37 | + |
| 38 | +[tasks.lint] |
| 39 | +description = "Run linting" |
| 40 | +depends = ["fmt"] |
| 41 | +sources = ["**/*.go", ".golangci.yml"] |
| 42 | +run = ["golangci-lint run ./...", "typos"] |
| 43 | + |
| 44 | +[tasks.doc] |
| 45 | +description = "Render the pkg docs locally" |
| 46 | +run = "pkgsite -open" |
| 47 | + |
| 48 | +[tasks.cov] |
| 49 | +description = "Calculate test coverage and render the html" |
| 50 | +outputs = ["{{vars.cov_data}}"] |
| 51 | +run = [ |
| 52 | + "go test -race -cover -covermode atomic -coverprofile {{vars.cov_data}} ./...", |
| 53 | + "go tool cover -html {{vars.cov_data}}", |
| 54 | +] |
| 55 | + |
| 56 | +[tasks.check] |
| 57 | +description = "Run tests and linting in one" |
| 58 | +run = ["mise run test", "mise run lint"] |
| 59 | + |
| 60 | +[tasks.sloc] |
| 61 | +description = "Print lines of code" |
| 62 | +run = "fd . -e go | xargs wc -l | sort -nr | head" |
| 63 | + |
| 64 | +[tasks.clean] |
| 65 | +description = "Remove build artifacts and other clutter" |
| 66 | +run = ["go clean ./...", "rm -rf {{vars.cov_data}}"] |
| 67 | + |
| 68 | +[tasks.update] |
| 69 | +description = "Updates dependencies in go.mod and go.sum" |
| 70 | +run = ["go get -u ./...", "go mod tidy"] |
0 commit comments