Add generated files check to github actions

This commit is contained in:
Marc Di Luzio 2020-07-07 12:59:10 +01:00
parent fc4fa3decf
commit c66e61921f
2 changed files with 19 additions and 1 deletions

View file

@ -23,6 +23,18 @@ jobs:
go-version: ^1.13
id: go
- name: Check generated files
run: |
PROTOC_ZIP=protoc-3.6.1-linux-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
sudo chmod -R o+r /usr/local/include/google/
rm -f $PROTOC_ZIP
make gen
git update-index --refresh
git diff-index --quiet HEAD
- name: Build and Test
run: make test

View file

@ -11,8 +11,14 @@ install:
go install -ldflags="-X 'github.com/mdiluz/rove/pkg/version.Version=${VERSION}'" ./...
gen:
@echo Installing go dependencies
go install \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \
github.com/golang/protobuf/protoc-gen-go
go mod download
@echo Generating rove server gRPC and gateway
protoc --proto_path proto --go_out=plugins=grpc:pkg/ --go_opt=paths=source_relative proto/rove/rove.proto
protoc --proto_path proto --go_out=plugins=grpc,paths=source_relative:pkg/ proto/rove/rove.proto
protoc --proto_path proto --grpc-gateway_out=paths=source_relative:pkg/ proto/rove/rove.proto
@echo Generating rove server swagger
protoc --proto_path proto --swagger_out=logtostderr=true:pkg/ proto/rove/rove.proto