From 40b67a416119964f161352a85af08064ba2556af Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Sat, 15 Feb 2025 13:34:33 +0100 Subject: [PATCH 1/2] Add check-generate target to makefile Signed-off-by: Evan Lezar --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 34d7b0a9a..800e1187c 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ endif CMDS := $(patsubst ./cmd/%/,%,$(sort $(dir $(wildcard ./cmd/*/)))) CMD_TARGETS := $(patsubst %,cmd-%, $(CMDS)) -CHECK_TARGETS := golangci-lint +CHECK_TARGETS := golangci-lint check-generate MAKE_TARGETS := binaries build build-image check fmt lint-internal test examples cmds coverage generate vendor check-modules $(CHECK_TARGETS) TARGETS := $(MAKE_TARGETS) $(CMD_TARGETS) @@ -113,6 +113,9 @@ generate-crds: generate-deepcopy .remove-crds rm -rf $(CURDIR)/deployments/helm/tmp_crds +check-generate: generate + git diff --exit-code HEAD + generate-deepcopy: .remove-deepcopy for dir in $(DEEPCOPY_SOURCES); do \ controller-gen \ From 3c5645037b5558dcf172011339c3976b6e0a24ec Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Sat, 15 Feb 2025 13:35:47 +0100 Subject: [PATCH 2/2] Add CI target for generated code Signed-off-by: Evan Lezar --- .github/workflows/golang.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/golang.yaml b/.github/workflows/golang.yaml index 882f119cd..94820214b 100644 --- a/.github/workflows/golang.yaml +++ b/.github/workflows/golang.yaml @@ -40,11 +40,16 @@ jobs: args: -v --timeout 5m skip-cache: true - - name: Check golang modules + - name: Golang modules run: | make check-modules make -C deployments/devel check-modules + - name: Generated code + run: | + make -C deployments/devel install-tools + make check-generate + test: name: Unit test runs-on: ubuntu-latest