Skip to content

Commit 16256d5

Browse files
authored
chore: add mise toolchain support (#699)
1 parent 310c9bd commit 16256d5

5 files changed

Lines changed: 65 additions & 12 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ dist/
33
buildkite.yaml
44
.bk.yaml
55
build-logs-*
6+
mise.local.toml
7+
.mise.local.toml

AGENT.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
This project is the Buildkite CLI (`bk`)
22

33
## Commands
4-
- Test: `go test ./...`
5-
- Lint: `docker-compose -f .buildkite/docker-compose.yaml run golangci-lint golangci-lint run`
6-
- Generate: `go generate` (required after GraphQL changes)
4+
- Bootstrap: `mise install`
5+
- Hooks: `mise run hooks`
6+
- Format: `mise run format`
7+
- Test: `mise run test`
8+
- Lint: `mise run lint`
9+
- Generate: `mise run generate` (required after GraphQL changes)
710
- Run: `go run main.go`
811

912
## Environment
@@ -15,5 +18,6 @@ This project is the Buildkite CLI (`bk`)
1518
- CLI commands: `pkg/cmd/`
1619

1720
## Notes
21+
- `mise.toml` pins the local Go/tool versions
1822
- CI: https://buildkite.com/buildkite/buildkite-cli
1923
- Always format after changing code

CONTRIBUTING.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@ We welcome contributions from the community to make Buildkite CLI, `bk`, project
66

77
To get started with contributing, please follow these steps:
88

9-
1. Fork the repository
10-
2. Create a feature branch with a nice name (`git checkout -b cli-new-feature`) for your changes
11-
3. Write your code
12-
* We use `golangci-lint` and would be good to use the same in order to pass a PR merge. You can use `docker-compose -f .buildkite/docker-compose.yaml run golangci-lint golangci-lint run` for that.
13-
* Make sure the tests are passing by running go test ./...
14-
5. Commit your changes and push them to your forked repository.
15-
7. Submit a pull request with a detailed description of your changes and linked to any relevant issues.
9+
1. Fork the repository.
10+
2. Create a feature branch with a nice name (`git checkout -b cli-new-feature`) for your changes.
11+
3. Install [mise](https://mise.jdx.dev/) and run `mise install`.
12+
4. Install the local git hooks with `mise run hooks`.
13+
5. Write your code.
14+
6. Run the local checks before opening a pull request.
15+
* Format the code with `mise run format`.
16+
* Lint with `mise run lint`.
17+
* Make sure the tests pass with `mise run test`.
18+
* Run `mise run generate` after GraphQL changes. If you need to refresh `schema.graphql`, set `BUILDKITE_GRAPHQL_TOKEN` first.
19+
* If you prefer the containerized lint setup, `docker-compose -f .buildkite/docker-compose.yaml run golangci-lint golangci-lint run` still works.
20+
7. Commit your changes and push them to your forked repository.
21+
8. Submit a pull request with a detailed description of your changes and links to any relevant issues.
1622

1723
The team maintaining this codebase will review your PR and start a CI build for it. For security reasons, we don't automatically run CI against forked repos, and a human will review your PR prior to its CI running.
1824

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,20 @@ We'd love to hear any feedback and questions you might have. Please [file an iss
2828

2929
## Development
3030

31-
Developed using Go 1.20+ with modules.
31+
This repository uses [mise](https://mise.jdx.dev/) to pin Go and the main
32+
local development tools.
3233

3334
```bash
3435
git clone git@github.com:buildkite/cli.git
3536
cd cli/
36-
go generate
37+
mise install
38+
mise run hooks
39+
mise run format
40+
mise run lint
41+
mise run test
42+
mise run generate
3743
go run main.go --help
3844
```
45+
46+
`mise.toml` pins Go `1.26.1` to match the current release build image. The
47+
module itself remains compatible with Go `1.25.0` as declared in `go.mod`.

mise.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Pinned local toolchain for contributors. The Go version matches the
2+
# repository's current release build image; the module minimum stays in go.mod.
3+
[tools]
4+
go = "1.26.1"
5+
golangci-lint = "2.11.3"
6+
lefthook = "2.1.4"
7+
"aqua:mvdan/gofumpt" = "0.9.2"
8+
"aqua:goreleaser/goreleaser" = "2.14.3"
9+
10+
[tasks.format]
11+
description = "Format Go files with gofumpt"
12+
run = "gofumpt -w ."
13+
14+
[tasks.lint]
15+
description = "Run golangci-lint with the repository configuration"
16+
run = "golangci-lint run --verbose --timeout 3m"
17+
18+
[tasks.test]
19+
description = "Run the Go test suite"
20+
run = "go test ./..."
21+
22+
[tasks.generate]
23+
description = "Regenerate the GraphQL client code"
24+
run = "go generate ./cmd/generate"
25+
26+
[tasks.hooks]
27+
description = "Install the repository git hooks"
28+
run = "lefthook install"
29+
30+
[tasks.ci]
31+
description = "Run the main local CI checks"
32+
depends = ["lint", "test"]

0 commit comments

Comments
 (0)