Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
codegen: add build target and CI check
Browse files Browse the repository at this point in the history
Adds a build target and check in the CI to ensure
autogenerated Go clients for APIs are always up to
date to avoids issues similar to the one fixed in 60fa307.

Also collapses the check for `go mod tidy` into the
`codegen` job.

Signed-off-by: Shashank Ram <[email protected]>
  • Loading branch information
shashankram committed Jul 22, 2021
1 parent 94394bd commit 416505a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
skip-pkg-cache: true
args: --timeout 5m --skip-dirs pkg/gen --skip-files "zz_generated.deepcopy.go$"

tidy:
name: Tidy
codegen:
name: Codegen
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -65,6 +65,8 @@ jobs:
go-version: 1.16
- name: go mod tidy
run: make go-mod-tidy
- name: Codegen checks
run: make check-codegen

mocks:
name: Mocks
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,13 @@ check-mocks:
@go run ./mockspec/generate.go
@git diff --exit-code || { echo "----- Please commit the changes made by 'go run ./mockspec/generate.go' -----"; exit 1; }

.PHONY: check-codegen
check-codegen:
@./codegen/gen-crd-client.sh
@git diff --exit-code || { echo "----- Please commit the changes made by './codegen/gen-crd-client.sh' -----"; exit 1; }

.PHONY: go-checks
go-checks: go-lint go-fmt go-mod-tidy check-mocks
go-checks: go-lint go-fmt go-mod-tidy check-mocks check-codegen

.PHONY: go-vet
go-vet:
Expand Down

0 comments on commit 416505a

Please sign in to comment.