From d646c7d36ca50752456261058e21ee24fa3793fe Mon Sep 17 00:00:00 2001 From: Dominic Black Date: Fri, 30 Oct 2026 13:18:35 +0000 Subject: [PATCH] Pin Go, golangci-lint and goreleaser in mise.toml The Go version was written out in five places across the two workflows, golangci-lint's in another, and none of it was pinned for local work, so my machine and CI could quietly drift apart. mise.toml is now the one place these versions live. CI installs them with jdx/mise-action, the lint step runs the golangci-lint mise put on PATH, and the release job runs goreleaser directly instead of through its action. setup-go used to cache Go modules and builds as well, which mise-action doesn't, so the test jobs now cache those themselves. --- .github/workflows/ci.yml | 40 +++++++++++++++++++++++++---------- .github/workflows/release.yml | 11 ++-------- mise.toml | 5 +++++ 3 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 mise.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4514cde..60ac4a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,10 +27,20 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v7 - - uses: actions/setup-go@v7 + - uses: jdx/mise-action@v4 + # mise-action caches the toolchain, not Go's module and build caches. + - name: Find Go caches + id: go-cache + run: | + echo "mod=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT" + echo "build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT" + - uses: actions/cache@v5 with: - go-version: "1.27.x" - check-latest: true + path: | + ${{ steps.go-cache.outputs.mod }} + ${{ steps.go-cache.outputs.build }} + key: go-${{ github.job }}-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('mise.toml', 'go.sum') }} + restore-keys: go-${{ github.job }}-${{ runner.os }}-${{ runner.arch }}- - run: go build ./... - run: go vet ./... - run: test -z "$(gofmt -l .)" @@ -40,13 +50,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - uses: actions/setup-go@v7 - with: - go-version: "1.27.x" - check-latest: true + - uses: jdx/mise-action@v4 - uses: golangci/golangci-lint-action@v9 with: - version: v2.14.0 + # Use the golangci-lint mise installed from mise.toml. + install-mode: none shell-integration: strategy: @@ -56,10 +64,20 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v7 - - uses: actions/setup-go@v7 + - uses: jdx/mise-action@v4 + # mise-action caches the toolchain, not Go's module and build caches. + - name: Find Go caches + id: go-cache + run: | + echo "mod=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT" + echo "build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT" + - uses: actions/cache@v5 with: - go-version: "1.27.x" - check-latest: true + path: | + ${{ steps.go-cache.outputs.mod }} + ${{ steps.go-cache.outputs.build }} + key: go-${{ github.job }}-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('mise.toml', 'go.sum') }} + restore-keys: go-${{ github.job }}-${{ runner.os }}-${{ runner.arch }}- - name: Install shells run: | if [ "$RUNNER_OS" = "Linux" ]; then diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index acc7e64..db247f7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,14 +23,7 @@ jobs: echo "::error::$GITHUB_REF_NAME is a lightweight tag; tag with git tag -a and the release notes as its message (see Releasing in the README)" exit 1 fi - - uses: actions/setup-go@v7 - with: - go-version: "1.27.x" - check-latest: true - - uses: goreleaser/goreleaser-action@v7 - with: - distribution: goreleaser - version: "~> v2" - args: release --clean + - uses: jdx/mise-action@v4 + - run: goreleaser release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..5ca7f2f --- /dev/null +++ b/mise.toml @@ -0,0 +1,5 @@ +# CI installs these with jdx/mise-action, so this is the one place to bump them. +[tools] +go = "1.27" +golangci-lint = "2.14.0" +goreleaser = "2"