diff --git a/.buildkite/Dockerfile b/.buildkite/Dockerfile deleted file mode 100644 index 4a82444d..00000000 --- a/.buildkite/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM golang:1.26.2@sha256:2a2b4b5791cea8ae09caecba7bad0bd9631def96e5fe362e4a5e67009fe4ae61 - -COPY --from=goreleaser/goreleaser-pro:v2.15.2@sha256:1eab5a6d8ac8a228fe796e8783d7ab63a64b6b51b3c601c0c38abdf60b22a383 /usr/bin/goreleaser /usr/local/bin/goreleaser -COPY --from=golangci/golangci-lint:v2.11.4@sha256:67dfc9eeeb0eb13fc1a36329c2c378197dc561f1edf1a7792e3f771606bb0e15 /usr/bin/golangci-lint /usr/local/bin/golangci-lint -COPY --from=ghcr.io/ko-build/ko:fc0e4c0582f0801600929b5aaf6981aabdf47148 /ko-app/ko /usr/local/bin/ko diff --git a/.buildkite/docker-compose.yaml b/.buildkite/docker-compose.yaml deleted file mode 100644 index 38493993..00000000 --- a/.buildkite/docker-compose.yaml +++ /dev/null @@ -1,21 +0,0 @@ -services: - golangci-lint: - image: golangci/golangci-lint:v2.11.4 - working_dir: /app - volumes: - - ..:/app - - ~/.cache/golangci-lint/v1.54.1:/root/.cache - goreleaser: - build: - context: . - environment: - - BUILDKITE_AGENT_JOB_API_SOCKET - - BUILDKITE_AGENT_JOB_API_TOKEN - - POSTHOG_API_KEY - - DOCKERHUB_USER - - DOCKERHUB_PASSWORD - working_dir: /go/src/github.com/buildkite/cli - volumes: - - ..:/go/src/github.com/buildkite/cli - - ${BUILDKITE_AGENT_JOB_API_SOCKET}:${BUILDKITE_AGENT_JOB_API_SOCKET} - - /var/run/docker.sock:/var/run/docker.sock diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command new file mode 100755 index 00000000..eadcc5ce --- /dev/null +++ b/.buildkite/hooks/pre-command @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -euo pipefail + +checkout_path="${BUILDKITE_BUILD_CHECKOUT_PATH:-$(pwd)}" +cache_root="${checkout_path}/.buildkite/cache-volume" + +mkdir -p \ + "${cache_root}/go/build" \ + "${cache_root}/go/pkg/mod" \ + "${cache_root}/golangci-lint" + +export GOCACHE="${cache_root}/go/build" +export GOMODCACHE="${cache_root}/go/pkg/mod" +export GOLANGCI_LINT_CACHE="${cache_root}/golangci-lint" diff --git a/.buildkite/pipeline.release.yml b/.buildkite/pipeline.release.yml index 3e958fd3..32855cb1 100644 --- a/.buildkite/pipeline.release.yml +++ b/.buildkite/pipeline.release.yml @@ -1,6 +1,8 @@ agents: queue: hosted +cache: ".buildkite/cache-volume" + steps: - label: ":terminal: build ({{matrix}})" matrix: @@ -10,25 +12,12 @@ steps: artifact_paths: - dist/**/* secrets: + - MISE_GITHUB_TOKEN - POSTHOG_API_KEY - OAUTH_CLIENT_ID + command: 'GOOS="{{matrix}}" .buildkite/release.sh release --clean --split' plugins: - - docker-compose#v5.12.1: - command: - - .buildkite/release.sh - - release - - --clean - - --split - config: .buildkite/docker-compose.yaml - entrypoint: /bin/sh - env: - - GOOS={{matrix}} - - POSTHOG_API_KEY - - OAUTH_CLIENT_ID - mount-buildkite-agent: true - run: goreleaser - shell: false - tty: true + - buildkite-plugins/mise#v1.1.1: ~ - wait @@ -36,20 +25,11 @@ steps: matrix: - "deb" - "rpm" + command: '.buildkite/upload-packages.sh "{{matrix}}"' plugins: - artifacts#v1.9.4: download: - dist/linux/* - - docker-compose#v5.12.1: - command: - - .buildkite/upload-packages.sh - - "{{matrix}}" - config: .buildkite/docker-compose.yaml - entrypoint: /bin/sh - mount-buildkite-agent: true - run: goreleaser - shell: false - tty: true - label: ":rocket: :github: release" artifact_paths: @@ -57,6 +37,7 @@ steps: env: AWS_REGION: us-east-1 secrets: + - MISE_GITHUB_TOKEN - POSTHOG_API_KEY - OAUTH_CLIENT_ID plugins: @@ -74,20 +55,5 @@ steps: - artifacts#v1.9.4: download: - dist/**/* - - docker-compose#v5.12.1: - command: - - .buildkite/release.sh - - continue - - --merge - config: .buildkite/docker-compose.yaml - entrypoint: /bin/sh - env: - - GITHUB_TOKEN - - DOCKERHUB_USER - - DOCKERHUB_PASSWORD - - POSTHOG_API_KEY - - OAUTH_CLIENT_ID - mount-buildkite-agent: true - run: goreleaser - shell: false - tty: true + - buildkite-plugins/mise#v1.1.1: ~ + command: '.buildkite/release.sh continue --merge' diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 39da0ca1..a090ce30 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,28 +1,31 @@ agents: queue: hosted +cache: ".buildkite/cache-volume" + steps: - name: ":golangci-lint: lint" - command: golangci-lint run --verbose --timeout 3m + command: 'golangci-lint run --verbose --timeout 3m' + secrets: + - MISE_GITHUB_TOKEN plugins: - - docker-compose#v5.12.1: - config: .buildkite/docker-compose.yaml - run: golangci-lint - tty: true + - buildkite-plugins/mise#v1.1.1: ~ - name: ":go: test" + key: test artifact_paths: - cover-tree.svg + secrets: + - MISE_GITHUB_TOKEN commands: + # Hosted agents inject org/token env that breaks config-precedence tests, + # so clear those variables in the command shell right before go test. + - unset BUILDKITE_ORGANIZATION_SLUG BUILDKITE_API_TOKEN - go test -coverprofile cover.out ./... - - go run github.com/nikolaydubina/go-cover-treemap@latest -coverprofile cover.out > cover-tree.svg + - go-cover-treemap -coverprofile cover.out > cover-tree.svg - echo '
Coverage tree mapTest coverage tree map
' | buildkite-agent annotate --style "info" plugins: - - docker-compose#v5.12.1: - config: .buildkite/docker-compose.yaml - run: golangci-lint - tty: true - mount-buildkite-agent: true + - buildkite-plugins/mise#v1.1.1: ~ - wait: ~ @@ -36,26 +39,12 @@ steps: artifact_paths: - dist/**/* secrets: + - MISE_GITHUB_TOKEN - POSTHOG_API_KEY - OAUTH_CLIENT_ID + command: 'GOOS="{{matrix}}" .buildkite/release.sh release --clean --snapshot --split' plugins: - - docker-compose#v5.12.1: - command: - - .buildkite/release.sh - - release - - --clean - - --snapshot - - --split - config: .buildkite/docker-compose.yaml - entrypoint: /bin/sh - env: - - GOOS={{matrix}} - - POSTHOG_API_KEY - - OAUTH_CLIENT_ID - mount-buildkite-agent: true - run: goreleaser - shell: false - tty: true + - buildkite-plugins/mise#v1.1.1: ~ - input: ":package: Create a release?" prompt: "Select the release type" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3f3eb2b7..9d1cbec8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,6 @@ To get started with contributing, please follow these steps: * Lint with `mise run lint`. * Make sure the tests pass with `mise run test`. * Run `mise run generate` after GraphQL changes. If you need to refresh `schema.graphql`, set `BUILDKITE_GRAPHQL_TOKEN` first. - * If you prefer the containerized lint setup, `docker-compose -f .buildkite/docker-compose.yaml run golangci-lint golangci-lint run` still works. 7. Commit your changes and push them to your forked repository. 8. Submit a pull request with a detailed description of your changes and links to any relevant issues. diff --git a/README.md b/README.md index ee850735..0ac63b15 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,6 @@ mise run generate go run main.go --help ``` -- `mise run build` builds `bk` into `dist/bk`, stamped with `git describe` -- `mise run install` installs `bk` into `$(go env GOBIN)` or `$(go env GOPATH)/bin` -- `mise run install:global` installs `bk` into `~/bin/bk` - -`mise.toml` pins Go `1.26.1` to match the current release build image. The -module itself remains compatible with Go `1.25.0` as declared in `go.mod`. +`mise.toml` pins the shared toolchain, including the release helpers used in +CI. The module itself remains compatible with Go `1.25.0` as declared in +`go.mod`. diff --git a/mise.lock b/mise.lock new file mode 100644 index 00000000..8f228b87 --- /dev/null +++ b/mise.lock @@ -0,0 +1,57 @@ +[[tools."aqua:mvdan/gofumpt"]] +version = "0.9.2" +backend = "aqua:mvdan/gofumpt" +"platforms.linux-arm64" = { checksum = "sha256:5acaa5a554050f55fc81ef02a8b0d14ab6b3c058a84513885286dc52d3451645", url = "https://github.com/mvdan/gofumpt/releases/download/v0.9.2/gofumpt_v0.9.2_linux_arm64"} +"platforms.linux-x64" = { checksum = "sha256:72cf61b12fef91eab6df6db4a4284f30616b5ead330112e28a1fa1cb15e57339", url = "https://github.com/mvdan/gofumpt/releases/download/v0.9.2/gofumpt_v0.9.2_linux_amd64"} +"platforms.macos-arm64" = { checksum = "sha256:c241fb742599a6cb0563d7377f59def65d451b23dd718dbc6ddf4ab5e695e8f1", url = "https://github.com/mvdan/gofumpt/releases/download/v0.9.2/gofumpt_v0.9.2_darwin_arm64"} +"platforms.macos-x64" = { checksum = "sha256:4172b912ec514038605f334fef9ed7b3f12ca3e40024cb0a622eab3073a55e57", url = "https://github.com/mvdan/gofumpt/releases/download/v0.9.2/gofumpt_v0.9.2_darwin_amd64"} +"platforms.windows-x64" = { checksum = "sha256:067236b55a8ef4547ddc7d78fbb7a38169de15bab02a1763cde6a132c59dd35c", url = "https://github.com/mvdan/gofumpt/releases/download/v0.9.2/gofumpt_v0.9.2_windows_amd64.exe"} + +[[tools."github:goreleaser/goreleaser-pro"]] +version = "2.15.2" +backend = "github:goreleaser/goreleaser-pro" +"platforms.linux-arm64" = { checksum = "sha256:cc6cc50a101e7f5cec645503555b39ac330b484513fd30fbf3b18245c57d57bc", url = "https://github.com/goreleaser/goreleaser-pro/releases/download/v2.15.2/goreleaser-pro_Linux_arm64.tar.gz", url_api = "https://api.github.com/repos/goreleaser/goreleaser-pro/releases/assets/385669235"} +"platforms.linux-x64" = { checksum = "sha256:61baf60a947158bdd5be73b474943483dc97cde5bad99206e999beb2532c4247", url = "https://github.com/goreleaser/goreleaser-pro/releases/download/v2.15.2/goreleaser-pro_Linux_x86_64.tar.gz", url_api = "https://api.github.com/repos/goreleaser/goreleaser-pro/releases/assets/385669248"} +"platforms.macos-arm64" = { checksum = "sha256:a7cee9cc5fada42d17ee033924535b0e508f654db6f3734e67776b7722c274d1", url = "https://github.com/goreleaser/goreleaser-pro/releases/download/v2.15.2/goreleaser-pro_Darwin_arm64.tar.gz", url_api = "https://api.github.com/repos/goreleaser/goreleaser-pro/releases/assets/385669138"} +"platforms.macos-x64" = { checksum = "sha256:0399c8f5b895ebb00524d7bd973937afb0f185142b24de40a0c032e13a3482b4", url = "https://github.com/goreleaser/goreleaser-pro/releases/download/v2.15.2/goreleaser-pro_Darwin_x86_64.tar.gz", url_api = "https://api.github.com/repos/goreleaser/goreleaser-pro/releases/assets/385669136"} +"platforms.windows-x64" = { checksum = "sha256:963d3e6262072d08089cd80caf47123d31e76588c9e847a5eaa44709830eaa93", url = "https://github.com/goreleaser/goreleaser-pro/releases/download/v2.15.2/goreleaser-pro_Windows_x86_64.zip", url_api = "https://api.github.com/repos/goreleaser/goreleaser-pro/releases/assets/385669379"} + +[[tools.go]] +version = "1.26.2" +backend = "core:go" +"platforms.linux-arm64" = { checksum = "sha256:c958a1fe1b361391db163a485e21f5f228142d6f8b584f6bef89b26f66dc5b23", url = "https://dl.google.com/go/go1.26.2.linux-arm64.tar.gz"} +"platforms.linux-x64" = { checksum = "sha256:990e6b4bbba816dc3ee129eaeaf4b42f17c2800b88a2166c265ac1a200262282", url = "https://dl.google.com/go/go1.26.2.linux-amd64.tar.gz"} +"platforms.macos-arm64" = { checksum = "sha256:32af1522bf3e3ff3975864780a429cc0b41d190ec7bf90faa661d6d64566e7af", url = "https://dl.google.com/go/go1.26.2.darwin-arm64.tar.gz"} +"platforms.macos-x64" = { checksum = "sha256:bc3f1500d9968c36d705442d90ba91addf9271665033748b82532682e90a7966", url = "https://dl.google.com/go/go1.26.2.darwin-amd64.tar.gz"} +"platforms.windows-x64" = { checksum = "sha256:98eb3570bade15cb826b0909338df6cc6d2cf590bc39c471142002db3832b708", url = "https://dl.google.com/go/go1.26.2.windows-amd64.zip"} + +[[tools."go:github.com/nikolaydubina/go-cover-treemap"]] +version = "1.5.1" +backend = "go:github.com/nikolaydubina/go-cover-treemap" + +[[tools.golangci-lint]] +version = "2.11.4" +backend = "aqua:golangci/golangci-lint" +"platforms.linux-arm64" = { checksum = "sha256:3bcfa2e6f3d32b2bf5cd75eaa876447507025e0303698633f722a05331988db4", url = "https://github.com/golangci/golangci-lint/releases/download/v2.11.4/golangci-lint-2.11.4-linux-arm64.tar.gz"} +"platforms.linux-x64" = { checksum = "sha256:200c5b7503f67b59a6743ccf32133026c174e272b930ee79aa2aa6f37aca7ef1", url = "https://github.com/golangci/golangci-lint/releases/download/v2.11.4/golangci-lint-2.11.4-linux-amd64.tar.gz"} +"platforms.macos-arm64" = { checksum = "sha256:02db2a2dae8b26812e53b0688a6f617e3ef1f489790e829ea22862cf76945675", url = "https://github.com/golangci/golangci-lint/releases/download/v2.11.4/golangci-lint-2.11.4-darwin-arm64.tar.gz"} +"platforms.macos-x64" = { checksum = "sha256:c900d4048db75d1edfd550fd11cf6a9b3008e7caa8e119fcddbc700412d63e60", url = "https://github.com/golangci/golangci-lint/releases/download/v2.11.4/golangci-lint-2.11.4-darwin-amd64.tar.gz"} +"platforms.windows-x64" = { checksum = "sha256:4932cfca5e75bf60fe1c576edf459e5e809e6644664a068185d64b84af3fad9e", url = "https://github.com/golangci/golangci-lint/releases/download/v2.11.4/golangci-lint-2.11.4-windows-amd64.zip"} + +[[tools.ko]] +version = "0.18.1" +backend = "aqua:ko-build/ko" +"platforms.linux-arm64" = { checksum = "sha256:9a26698876892128952fa3d038a4e99bea961d0d225865c60474b79e3db12e99", url = "https://github.com/ko-build/ko/releases/download/v0.18.1/ko_0.18.1_Linux_arm64.tar.gz"} +"platforms.linux-x64" = { checksum = "sha256:048ab11818089a43b7b74bc554494a79a3fd0d9822c061142e5cd3cf8b30cb27", url = "https://github.com/ko-build/ko/releases/download/v0.18.1/ko_0.18.1_Linux_x86_64.tar.gz"} +"platforms.macos-arm64" = { checksum = "sha256:752a639e0fbc013a35a43974b5ed87e7008bc2aee4952dfd2cc19f0013205492", url = "https://github.com/ko-build/ko/releases/download/v0.18.1/ko_0.18.1_Darwin_arm64.tar.gz"} +"platforms.macos-x64" = { checksum = "sha256:0e0dd8fddbefebb8572ece4dca8f07a7472de862fedd7e9845fd9d651e0d5dbe", url = "https://github.com/ko-build/ko/releases/download/v0.18.1/ko_0.18.1_Darwin_x86_64.tar.gz"} +"platforms.windows-x64" = { checksum = "sha256:d15c5e391279a2222d4d659ac53047e08d70e21fea54b2133f0a5c25a1f1f694", url = "https://github.com/ko-build/ko/releases/download/v0.18.1/ko_0.18.1_Windows_x86_64.tar.gz"} + +[[tools.lefthook]] +version = "2.1.5" +backend = "aqua:evilmartians/lefthook" +"platforms.linux-arm64" = { checksum = "sha256:0823d67541e34d4530d678a9492dba8e1edcfc19cbdbc6d28014cb97a8522c36", url = "https://github.com/evilmartians/lefthook/releases/download/v2.1.5/lefthook_2.1.5_Linux_aarch64.gz"} +"platforms.linux-x64" = { checksum = "sha256:0faf5a547afbcedc3f2e9bef46053a73bcbfc2478e47d39bde30784e08f97190", url = "https://github.com/evilmartians/lefthook/releases/download/v2.1.5/lefthook_2.1.5_Linux_x86_64.gz"} +"platforms.macos-arm64" = { checksum = "sha256:f3aeef5fc287c6619a2f043ce3199e514bfc0639739be393a3759dd4470ee292", url = "https://github.com/evilmartians/lefthook/releases/download/v2.1.5/lefthook_2.1.5_MacOS_arm64.gz"} +"platforms.macos-x64" = { checksum = "sha256:27e48734de8f632e64fff07e8ae9f82514713b9f77e7bf91d8925ef1ea59a901", url = "https://github.com/evilmartians/lefthook/releases/download/v2.1.5/lefthook_2.1.5_MacOS_x86_64.gz"} +"platforms.windows-x64" = { checksum = "sha256:bf14d028984d24a72887f4f73d8899f5879c11786f4ba79a81c676fb3cefce1e", url = "https://github.com/evilmartians/lefthook/releases/download/v2.1.5/lefthook_2.1.5_Windows_x86_64.gz"} diff --git a/mise.toml b/mise.toml index 7b129365..1226dfee 100644 --- a/mise.toml +++ b/mise.toml @@ -1,11 +1,17 @@ # Pinned local toolchain for contributors. The Go version matches the -# repository's current release build image; the module minimum stays in go.mod. +# CI and release toolchain; the module minimum stays in go.mod. +[settings] +experimental = true +lockfile = true + [tools] go = "1.26.2" golangci-lint = "2.11.4" lefthook = "2.1.5" "aqua:mvdan/gofumpt" = "0.9.2" -"aqua:goreleaser/goreleaser" = "2.15.2" +"go:github.com/nikolaydubina/go-cover-treemap" = "1.5.1" +"github:goreleaser/goreleaser-pro" = "2.15.2" +ko = "0.18.1" [tasks.format] description = "Format Go files with gofumpt"