diff --git a/.github/workflows/go-tests.yml b/.github/workflows/go-tests.yml index 52de434ad9b..b9a748cdd3c 100644 --- a/.github/workflows/go-tests.yml +++ b/.github/workflows/go-tests.yml @@ -131,6 +131,9 @@ jobs: - name: Run "make generate" and check for changes run: | set -e + apt install protobuf-compiler + go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2 + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1 make generate 2>/dev/null if [[ $(git status --porcelain) ]]; then echo "Error: Uncommitted changes found after running 'make generate'. Please commit all generated code." diff --git a/Makefile b/Makefile index c8d1b001530..36d1b506f1f 100644 --- a/Makefile +++ b/Makefile @@ -268,8 +268,7 @@ generate: ## Generate code for the database and APIs $(GO) generate ./pkg/database/ent $(GO) generate ./pkg/models $(GO) generate ./pkg/modelscapi - # TODO: install the protoc-gen-go plugin in CI - # $(GO) generate ./pkg/protobufs + $(GO) generate ./pkg/protobufs .PHONY: testclean testclean: bats-clean ## Remove test artifacts diff --git a/pkg/protobufs/generate.go b/pkg/protobufs/generate.go index 44e81008e73..de868a5310a 100644 --- a/pkg/protobufs/generate.go +++ b/pkg/protobufs/generate.go @@ -1,7 +1,14 @@ package protobufs +// Dependencies: +// // apt install protobuf-compiler -// go install google.golang.org/protobuf/cmd/protoc-gen-go@latest -// go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest +// +// keep this in sync with go.mod +// go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2 +// +// Not the same versions as google.golang.org/grpc +// go list -m -versions google.golang.org/grpc/cmd/protoc-gen-go-grpc +// go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5. //go:generate protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative notifier.proto