diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml index 881ac811..4202d011 100644 --- a/.github/workflows/codegen.yml +++ b/.github/workflows/codegen.yml @@ -27,7 +27,7 @@ jobs: - name: Display Go version run: go version - name: Generate mocks - run: go generate ./... + run: make generate - name: ensure no changes run: | - [ -z git status --porcelain=v1 ] || echo "Modified files detected" && exit 1 + [ -z git status --porcelain=v1 ] || echo "Modified files detected, run 'make generate'" && git status && exit 1 diff --git a/Makefile b/Makefile index c329ebf0..d20bc731 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,21 @@ TEST_COUNT ?= 10 COVERAGE_FILE ?= coverage.out -build: +build: ensure_go_version go build -v ./... -ensure_go_version: - @go version | grep -q 'go1.21' || (echo "Please use go1.21" && exit 1) - -ensure_golangcilint_1_59: - @golangci-lint --version | grep -q '1.59' || (echo "Please use golangci-lint 1.59" && exit 1) +generate: ensure_go_version + go generate ./... test: ensure_go_version go test -race -fullpath -shuffle on -count $(TEST_COUNT) -coverprofile=$(COVERAGE_FILE) ./... lint: ensure_go_version golangci-lint run -c .golangci.yml + +ensure_go_version: + @go version | grep -q 'go1.21' || (echo "Please use go1.21" && exit 1) + +ensure_golangcilint_1_59: + @golangci-lint --version | grep -q '1.59' || (echo "Please use golangci-lint 1.59" && exit 1) +