Skip to content

Commit

Permalink
Verify that proto-generated files are up-to-date (#1433)
Browse files Browse the repository at this point in the history
* Verify that proto-generated files are up-to-date

Signed-off-by: Yuri Shkuro <ys@uber.com>

* Pass protoc path

Signed-off-by: Yuri Shkuro <ys@uber.com>

* Remove override in generated file

Signed-off-by: Yuri Shkuro <ys@uber.com>
  • Loading branch information
yurishkuro committed Mar 20, 2019
1 parent edf92eb commit effb9a5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ matrix:
env:
- TESTS=true
- COVERAGE=true
- go: "1.11.1"
env:
- PROTO_GEN_TEST=true
- go: "1.11.1"
env:
- ALL_IN_ONE=true
Expand Down Expand Up @@ -52,6 +55,12 @@ install:
- if [ "$ALL_IN_ONE" == true ]; then bash ./scripts/travis/install-ui-deps.sh ; fi
- if [ "$DOCKER" == true ]; then bash ./scripts/travis/install-ui-deps.sh ; fi
- if [ "$CROSSDOCK" == true ]; then bash ./scripts/travis/install-crossdock-deps.sh ; fi
- |
if [ "$PROTO_GEN_TEST" == true ]; then
make proto-install
curl -L https://github.com/google/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip -o /tmp/protoc.zip
unzip /tmp/protoc.zip -d "$HOME"/protoc
fi
script:
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
Expand All @@ -63,6 +72,7 @@ script:
- if [ "$KAFKA_INTEGRATION_TEST" == true ]; then bash ./scripts/travis/kafka-integration-test.sh ; else echo 'skipping kafka integration test'; fi
- if [ "$CASSANDRA_INTEGRATION_TEST" == true ]; then bash ./scripts/travis/cassandra-integration-test.sh ; else echo 'skipping cassandra integration test'; fi
- if [ "$HOTROD" == true ]; then bash ./scripts/travis/hotrod-integration-test.sh ; else echo 'skipping hotrod example'; fi
- if [ "$PROTO_GEN_TEST" == true ]; then make proto PROTOC=$HOME/protoc/bin/protoc && git diff --name-status --exit-code ; else echo 'skipping protoc validation'; fi

after_success:
- if [ "$COVERAGE" == true ]; then mv cover.out coverage.txt ; else echo 'skipping coverage'; fi
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ generate-mocks: install-mockery
echo-version:
@echo $(GIT_CLOSEST_TAG)

PROTOC := protoc
PROTO_INCLUDES := \
-I model/proto \
-I vendor/github.com/grpc-ecosystem/grpc-gateway \
Expand Down Expand Up @@ -372,19 +373,19 @@ proto:
# TODO use Docker container instead of installed protoc
# (https://medium.com/@linchenon/generate-grpc-and-protobuf-libraries-with-containers-c15ba4e4f3ad)
#
protoc \
$(PROTOC) \
$(PROTO_INCLUDES) \
--gogo_out=plugins=grpc,$(PROTO_GOGO_MAPPINGS):$(PWD)/model/ \
model/proto/model.proto

protoc \
$(PROTOC) \
$(PROTO_INCLUDES) \
--gogo_out=plugins=grpc,$(PROTO_GOGO_MAPPINGS):$(PWD)/proto-gen/api_v2/ \
--grpc-gateway_out=$(PROTO_GOGO_MAPPINGS):$(PWD)/proto-gen/api_v2/ \
--swagger_out=$(PWD)/proto-gen/openapi/ \
model/proto/api_v2.proto

protoc \
$(PROTOC) \
-I model/proto \
--go_out=$(PWD)/model/prototest/ \
model/proto/model_test.proto
Expand All @@ -397,5 +398,4 @@ proto-install:
./vendor/github.com/gogo/protobuf/protoc-gen-gogo \
./vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \
./vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
# ./vendor/github.com/mwitkow/go-proto-validators/protoc-gen-govalidators \
# ./vendor/github.com/rakyll/statik
# ./vendor/github.com/mwitkow/go-proto-validators/protoc-gen-govalidators

0 comments on commit effb9a5

Please sign in to comment.