ci: Add check-generated
And remove makefile targets that can be accomplished with --always-make
This commit is contained in:
parent
c44b54dea7
commit
1abd042162
|
@ -115,6 +115,36 @@ jobs:
|
|||
fi
|
||||
- run: *notify-slack-failure
|
||||
|
||||
check-generated-protobuf:
|
||||
docker:
|
||||
- image: *GOLANG_IMAGE
|
||||
environment:
|
||||
<<: *ENVIRONMENT
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install protobuf
|
||||
command: |
|
||||
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.12.3/protoc-3.12.3-linux-x86_64.zip
|
||||
sudo unzip -d /usr/local protoc-*.zip
|
||||
sudo chmod +x /usr/local/bin/protoc
|
||||
rm protoc-*.zip
|
||||
- run:
|
||||
name: Install gogo/protobuf
|
||||
command: |
|
||||
gogo_version=$(go list -m github.com/gogo/protobuf | awk '{print $2}')
|
||||
mkdir -p .gotools; cd .gotools; go mod init consul-tools
|
||||
go get -v github.com/hashicorp/protoc-gen-go-binary
|
||||
go get -v github.com/gogo/protobuf/protoc-gen-gofast@${gogo_version}
|
||||
|
||||
- run:
|
||||
command: make --always-make proto
|
||||
- run: |
|
||||
if ! git diff --exit-code; then
|
||||
echo "Generated code was not updated correctly"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
go-test:
|
||||
docker:
|
||||
- image: *GOLANG_IMAGE
|
||||
|
@ -744,6 +774,7 @@ workflows:
|
|||
- stable-website
|
||||
- /^docs\/.*/
|
||||
- /^ui\/.*/
|
||||
- check-generated-protobuf: *filter-ignore-non-go-branches
|
||||
- lint-consul-retry: *filter-ignore-non-go-branches
|
||||
- lint: *filter-ignore-non-go-branches
|
||||
- test-connect-ca-providers: *filter-ignore-non-go-branches
|
||||
|
|
10
GNUmakefile
10
GNUmakefile
|
@ -363,14 +363,6 @@ else
|
|||
@go test -v ./agent/connect/ca
|
||||
endif
|
||||
|
||||
proto-delete:
|
||||
@echo "Removing $(PROTOGOFILES)"
|
||||
-@rm $(PROTOGOFILES)
|
||||
@echo "Removing $(PROTOGOBINFILES)"
|
||||
-@rm $(PROTOGOBINFILES)
|
||||
|
||||
proto-rebuild: proto-delete proto
|
||||
|
||||
proto: $(PROTOGOFILES) $(PROTOGOBINFILES)
|
||||
@echo "Generated all protobuf Go files"
|
||||
|
||||
|
@ -387,4 +379,4 @@ module-versions:
|
|||
|
||||
.PHONY: all ci bin dev dist cov test test-flake test-internal cover lint ui static-assets tools
|
||||
.PHONY: docker-images go-build-image ui-build-image static-assets-docker consul-docker ui-docker
|
||||
.PHONY: version proto proto-rebuild proto-delete test-envoy-integ
|
||||
.PHONY: version proto test-envoy-integ
|
||||
|
|
|
@ -116,7 +116,7 @@ function main {
|
|||
return 1
|
||||
fi
|
||||
|
||||
BUILD_TAGS=$(sed -e '/^[:space:]*$/,$d' < "${proto_path}" | grep '// +build')
|
||||
BUILD_TAGS=$(sed -e '/^[[:space:]]*$/,$d' < "${proto_path}" | grep '// +build')
|
||||
if test -n "${BUILD_TAGS}"
|
||||
then
|
||||
echo -e "${BUILD_TAGS}\n" >> "${proto_go_path}.new"
|
||||
|
|
Loading…
Reference in New Issue