From f28c0a8deea4c281c77f7399ee87979deed0b3c2 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Fri, 9 Oct 2026 12:27:45 +1100 Subject: [PATCH] chore(task): install the pinned tooling with task setup task setup installs the golangci-lint CI pins, the protobuf generators and the dashboard dependencies, and warns by name about the tools it cannot install (Go, Task, Node, Docker). The linter version now lives in one file read by both the setup task and both workflows, so a local checkout and the gate cannot run different linters. --- .github/workflows/deploy.yml | 2 +- .github/workflows/quality.yml | 2 +- .golangci-version | 1 + Taskfile.yml | 29 +++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 .golangci-version diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ddfb5fe09..5197caa25 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -66,7 +66,7 @@ jobs: - name: Install quality tools run: | - go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.2 + go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(cat .golangci-version) go install mvdan.cc/gofumpt@v0.11.0 go install github.com/go-task/task/v3/cmd/task@v3.48.0 diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index e7b0e6fbb..99f12201b 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -33,7 +33,7 @@ jobs: - name: Install quality tools run: | go install github.com/go-task/task/v3/cmd/task@v3.48.0 - go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.2 + go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(cat .golangci-version) go install mvdan.cc/gofumpt@v0.11.0 bash tools/proto.sh install diff --git a/.golangci-version b/.golangci-version new file mode 100644 index 000000000..095c2a17d --- /dev/null +++ b/.golangci-version @@ -0,0 +1 @@ +v2.13.2 diff --git a/Taskfile.yml b/Taskfile.yml index 22e1ea575..15a6e4f2a 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -9,6 +9,35 @@ tasks: cmds: - task --list + setup: + desc: Install the pinned tooling and dependencies a checkout needs + cmds: + # Report what this task cannot install for you, so a missing Go, Node or + # Docker fails here by name rather than somewhere inside the gate. + - | + set -eu + missing= + for tool in go task node npm docker; do + command -v "$tool" >/dev/null 2>&1 || missing="$missing $tool" + done + if [ -n "$missing" ]; then + echo "warning: not installed (AGENTS.md, Build and gate):$missing" >&2 + fi + # The pin is one file, read here and by .github/workflows, so the linter + # running locally and the one running the gate cannot drift apart. + - | + set -eu + want=$(cat {{.ROOT_DIR}}/.golangci-version) + have=$(golangci-lint --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true) + if [ "$have" = "${want#v}" ]; then + echo "golangci-lint $want already installed" + else + echo "installing golangci-lint $want (have: ${have:-none})" + GOBIN="$(go env GOPATH)/bin" go install "github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$want" + fi + - task: proto:install + - task: ui:deps + fmt: desc: Fix and format Go source with the gate's configured formatters cmds: