From c4da401b19dd7f8f301227fe2b88a9739cefcbfc Mon Sep 17 00:00:00 2001 From: Nathan ter Bogt Date: Mon, 8 Dec 2025 17:07:51 +1300 Subject: [PATCH 1/4] Converting make to mise --- .github/workflows/quality.yml | 23 ++++++++-------- .github/workflows/release.yml | 25 ++++++------------ .gitignore | 1 + .mise.toml | 50 +++++++++++++++++++++++++++++++++++ Makefile | 22 --------------- 5 files changed, 70 insertions(+), 51 deletions(-) create mode 100644 .mise.toml delete mode 100644 Makefile diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index e9afa08..6470184 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -9,17 +9,16 @@ jobs: name: 📋 GolangCI runs-on: ubuntu-latest steps: - - name: ⬇️ Git clone the repository - uses: actions/checkout@v4 + - name: ⬇️ Git clone the repository + uses: actions/checkout@v6 - - name: 📦 Install Go - uses: actions/setup-go@v5 - with: - go-version-file: 'go.mod' + - name: 📦 Install Mise + run: | + curl https://mise.run | sh + mise install + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Action sometimes causes threading. Recommended to run in separate workflow action. - # See https://github.com/golangci/golangci-lint-action?tab=readme-ov-file#how-to-use - - name: 🧪 GolangCI - uses: golangci/golangci-lint-action@v8 - with: - version: v2.3 + - name: 🧪 Lint + run: | + mise run lint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 420be9a..3311b98 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,27 +14,18 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version-file: 'go.mod' - - - name: Login to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: 📦 Install Mise + run: | + curl https://mise.run | sh + mise install + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v6 - with: - distribution: goreleaser - version: "~> v2" - args: release --clean + run: mise release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 1d700ec..bd016f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea vendor +bin dist diff --git a/.mise.toml b/.mise.toml new file mode 100644 index 0000000..99f40d0 --- /dev/null +++ b/.mise.toml @@ -0,0 +1,50 @@ +[tools] +go = "1.25" +"go:github.com/daixiang0/gci" = "latest" +"ubi:golangci/golangci-lint" = "2.5" +"ubi:goreleaser/goreleaser" = "2.12" + +[env] +CGO_ENABLED=0 +LGFLAGS="-extldflags '-static'" +IMAGE="skpr/grpc-go:latest" +PB_DIR="./pb" + +[tasks.vendor] +description = "Vendor resets the main module's vendor directory to include all packages needed to build the application" +run = "go mod vendor" +depends = ["generate"] + +[tasks.tidy] +description = "Tidy makes sure go.mod matches the source code in the module" +run = "go mod tidy" + +[tasks.generate] +description = "Build the grpc protocol" +run = ''' +rm -rf $PB_DIR +mkdir -p $PB_DIR +# Sadly can't get protoc on mac through mise. +docker build -t $IMAGE dockerfiles/grpc-go +docker run -it -w /data -v .:/data $IMAGE /bin/bash -c 'protoc --go_out=./pb --go_opt=paths=source_relative --go-grpc_out=./pb --go-grpc_opt=paths=source_relative *.proto' +''' + +[tasks."build"] +description = "Build the application" +run = "go build -o bin/apiserver-mock -ldflags=${CLI_LDFLAGS} github.com/skpr/api/cmd/apiserver-mock" +depends = ["vendor"] + +[tasks."lint"] +description = "Linting automatically checks code for errors and style issues" +run = "golangci-lint run" +depends = ["tidy"] + +[tasks.test] +description = "Checks to verify code correctness" +run = "go test -cover ./..." +depends = ["vendor"] + +[tasks.release] +description = "Release the command line interface" +run = "goreleaser" +depends = ["build"] diff --git a/Makefile b/Makefile deleted file mode 100644 index a0c7b24..0000000 --- a/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/make -f - -# Directory to store GRPC package. -DIR=./pb - -# Image used to build the package. -IMAGE=skpr/grpc-go:latest - -# Builds the client/server code. -build: - # Cleaning up directories. - rm -fR $(DIR) - mkdir -p $(DIR) - # Building image. - docker build -t $(IMAGE) dockerfiles/grpc-go - # Building package. - docker run -it -w $(PWD) -v $(PWD):$(PWD) $(IMAGE) /bin/bash -c 'protoc --go_out=./pb --go_opt=paths=source_relative --go-grpc_out=./pb --go-grpc_opt=paths=source_relative *.proto' - -docs: - docker run --rm -v $(pwd)/doc:/out pseudomuto/protoc-gen-doc --doc_opt=markdown,docs.md - -.PHONY: * From 90f7f53bd2f53c16bcf50d8834115ebf1686a42b Mon Sep 17 00:00:00 2001 From: Nathan ter Bogt Date: Mon, 8 Dec 2025 17:18:45 +1300 Subject: [PATCH 2/4] Adding a run command to fire it all up in one go --- .mise.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.mise.toml b/.mise.toml index 99f40d0..6f3c2bc 100644 --- a/.mise.toml +++ b/.mise.toml @@ -34,6 +34,11 @@ description = "Build the application" run = "go build -o bin/apiserver-mock -ldflags=${CLI_LDFLAGS} github.com/skpr/api/cmd/apiserver-mock" depends = ["vendor"] +[tasks.run] +description = "Run the application" +run = "bin/apiserver-mock" +depends = ["build"] + [tasks."lint"] description = "Linting automatically checks code for errors and style issues" run = "golangci-lint run" From 474f4cd40b905470c1db8e16050750864dc81035 Mon Sep 17 00:00:00 2001 From: Nathan ter Bogt Date: Mon, 8 Dec 2025 17:35:46 +1300 Subject: [PATCH 3/4] Don't run tidy on lint. Can hide issues --- .mise.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/.mise.toml b/.mise.toml index 6f3c2bc..4e553c2 100644 --- a/.mise.toml +++ b/.mise.toml @@ -42,7 +42,6 @@ depends = ["build"] [tasks."lint"] description = "Linting automatically checks code for errors and style issues" run = "golangci-lint run" -depends = ["tidy"] [tasks.test] description = "Checks to verify code correctness" From a5fab63e78654c551b75657cf956a419a0da329f Mon Sep 17 00:00:00 2001 From: Nathan ter Bogt Date: Wed, 17 Dec 2025 08:46:49 +1300 Subject: [PATCH 4/4] Updating run run to run mock --- .mise.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mise.toml b/.mise.toml index 4e553c2..1e888d3 100644 --- a/.mise.toml +++ b/.mise.toml @@ -34,7 +34,7 @@ description = "Build the application" run = "go build -o bin/apiserver-mock -ldflags=${CLI_LDFLAGS} github.com/skpr/api/cmd/apiserver-mock" depends = ["vendor"] -[tasks.run] +[tasks.mock] description = "Run the application" run = "bin/apiserver-mock" depends = ["build"]