Skip to content

Commit

Permalink
Optimize CI with travis
Browse files Browse the repository at this point in the history
* Use container-based infrastructure of Travis
* Avoid building protoc every time
* Avoid building `go tool vet`
  • Loading branch information
yugui committed Sep 3, 2015
1 parent 6e59041 commit 2d670f9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 14 deletions.
21 changes: 21 additions & 0 deletions .travis.build-protoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh -eu
protoc_version=$1
if test -z "${protoc_version}"; then
echo "Usage: .travis.build-protoc.sh protoc-version"
exit 1
fi
if ! $HOME/local/bin/protoc-${protoc_version} --version 2>/dev/null; then
rm -rf $HOME/local

wget https://github.com/google/protobuf/archive/v${protoc_version}.tar.gz
tar xvzf v${protoc_version}.tar.gz
cd protobuf-${protoc_version}
./autogen.sh
./configure --prefix=$HOME/local --program-suffix=-${protoc_version}
make -j 4
make install
fi
ln -sf $HOME/local/bin/protoc-${protoc_version} $HOME/local/bin/protoc

echo \$ $HOME/local/bin/protoc --version
$HOME/local/bin/protoc --version
31 changes: 17 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
branches:
only:
- master
language: go

sudo: false
go:
- 1.3
- tip
cache:
directories:
- $HOME/local
before_install:
- cd /tmp
- wget https://github.com/google/protobuf/archive/v3.0.0-alpha-2.tar.gz
- tar xvzf v3.0.0-alpha-2.tar.gz
- cd protobuf-3.0.0-alpha-2
- ./autogen.sh
- ./configure
- make
- sudo make install
- ./.travis.build-protoc.sh 3.0.0-alpha-2
- go get github.com/golang/lint/golint
- go get golang.org/x/tools/cmd/vet
install:
- go get github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway
script:
- make examples
- test -z "$(git -C $GOPATH/src/github.com/gengo/grpc-gateway status --porcelain)"
- go test -v github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/... --logtostderr
- golint github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway
- golint github.com/gengo/grpc-gateway/runtime
- go tool vet $GOPATH/src/github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway
- go tool vet $GOPATH/src/github.com/gengo/grpc-gateway/runtime
- golint github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/...
- golint github.com/gengo/grpc-gateway/runtime/...
- golint github.com/gengo/grpc-gateway/utilities/...
- go vet github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/...
- go vet github.com/gengo/grpc-gateway/runtime/...
- go vet github.com/gengo/grpc-gateway/utilities/...
env:
global:
- "PATH=$PATH:$HOME/local/bin"

0 comments on commit 2d670f9

Please sign in to comment.