Ensure mise and go.mod are aligned

go.mod and the tool versions (here, mise) need to be in sync.
This creates a test to verify they are aligned.

Signed-off-by: Jean-Philippe Evrard <open-source@a.spamming.party>
This commit is contained in:
Jean-Philippe Evrard
2026-07-28 17:51:27 +02:00
parent c2c263a646
commit 18d163a2b1
2 changed files with 29 additions and 2 deletions
@@ -9,6 +9,23 @@ permissions:
contents: read
jobs:
go-version:
name: Check Go version consistency
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- name: checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Check Go version consistency
run: make check-go-version
pr-short-tests:
name: Run short go tests
runs-on: ubuntu-latest
+12 -2
View File
@@ -1,5 +1,5 @@
.DEFAULT: all
.PHONY: all clean install-tools dev-image release dev-manifest e2e-test minikube-publish test lint lint-go lint-sh lint-ghactions lint-docs
.PHONY: all clean install-tools dev-image release dev-manifest e2e-test minikube-publish test lint lint-go lint-sh lint-ghactions lint-docs check-go-version
REGISTRY ?= ghcr.io
IMAGE_NAME ?= kubereboot/kured
@@ -54,6 +54,15 @@ test: lint
lint: lint-sh lint-ghactions lint-go
check-go-version:
@echo "Checking Go version consistency"
@go_version="$$(sed -nE 's/^go[[:space:]]+([0-9]+\.[0-9]+\.[0-9]+)[[:space:]]*$$/\1/p' go.mod)"; \
mise_version="$$(sed -nE 's/^go[[:space:]]*=[[:space:]]*"([0-9]+\.[0-9]+\.[0-9]+)"[[:space:]]*$$/\1/p' .config/mise.toml)"; \
if [ -z "$$go_version" ] || [ -z "$$mise_version" ] || [ "$$go_version" != "$$mise_version" ]; then \
echo "Go version mismatch or invalid format: go.mod=$${go_version:-invalid}, .config/mise.toml=$${mise_version:-invalid}" >&2; \
exit 1; \
fi
lint-sh:
@echo "Running shellcheck"
find . -name '*.sh' | xargs -n1 shellcheck
@@ -72,4 +81,5 @@ lint-docs:
lint-goreleaser:
@echo "Checking goreleaser"
goreleaser check
goreleaser check