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"