Skip to content

Commit

Permalink
Add install-protobuf.sh and make .travis.yml always test proto for te…
Browse files Browse the repository at this point in the history
…sting this PR
  • Loading branch information
dfawley committed Aug 15, 2017
1 parent 735eae0 commit d1a39b9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ go_import_path: google.golang.org/grpc
before_install:
- if [[ $TRAVIS_GO_VERSION = 1.8* ]]; then go get -u github.com/golang/lint/golint honnef.co/go/tools/cmd/staticcheck; fi
- go get -u golang.org/x/tools/cmd/goimports github.com/axw/gocov/gocov github.com/mattn/goveralls golang.org/x/tools/cmd/cover
- if [[ "$TRAVIS_EVENT_TYPE" = cron ]]; then PROTOBUF_VERSION=3.3.0 ./install-protobuf.sh && PATH=/home/travis/bin:$PATH protoc --version; fi
- PROTOBUF_VERSION=3.3.0 ./install-protobuf.sh

script:
- 'if [[ "$TRAVIS_EVENT_TYPE" = cron ]]; then PATH=/home/travis/bin:$PATH make proto && ! git status --porcelain | tee /dev/stderr | read || (git status; git diff; exit 1); fi'
- 'PATH=/home/travis/bin:$PATH make proto && ! git status --porcelain | tee /dev/stderr | read || (git status; git diff; exit 1)'
- 'set -o pipefail && git ls-files "*.go" | xargs grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)\|DO NOT EDIT" 2>&1 | tee /dev/stderr | (! read)'
- 'set -o pipefail && gofmt -s -d -l . 2>&1 | tee /dev/stderr | (! read)'
- 'set -o pipefail && goimports -l . 2>&1 | tee /dev/stderr | (! read)'
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ proto:
echo "error: protoc not installed" >&2; \
exit 1; \
fi
go get -u -v github.com/golang/protobuf/protoc-gen-go
go get -u -v github.com/golang/protobuf/protoc-gen-go golang.org/x/tools/cmd/stringer
go generate google.golang.org/grpc/...

test: testdeps
Expand Down
4 changes: 2 additions & 2 deletions codes/code_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions install-protobuf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -ex

die() {
echo "$@" >&2
exit 1
}

case "$PROTOBUF_VERSION" in
3*)
basename=protoc-$PROTOBUF_VERSION
;;
*)
die "unknown protobuf version: $PROTOBUF_VERSION"
;;
esac

cd /home/travis

wget https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/$basename-linux-x86_64.zip
unzip $basename-linux-x86_64.zip
bin/protoc --version

0 comments on commit d1a39b9

Please sign in to comment.