Skip to content

Commit

Permalink
Configure Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
yugui committed Jun 2, 2016
1 parent 0f57083 commit b9c7b5b
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 37 deletions.
23 changes: 0 additions & 23 deletions .travis.build-protoc.sh

This file was deleted.

45 changes: 31 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,49 @@
branches:
only:
- master
language: go
sudo: false
go:
- 1.6.2
- tip
cache:
directories:
- $HOME/local
- /tmp/bazel_travis

matrix:
include:
- language: go
go: 1.6.2
env:
- USE_BAZEL=false
- language: go
go: tip
env:
- USE_BAZEL=false
- language: c
jdk: oraclejdk8
env:
- USE_BAZEL=true
- PATH="$PATH:$HOME/local/bazel/bin"

before_install:
- ./.travis.build-protoc.sh 3.0.0-beta-3
- go get github.com/golang/lint/golint
- $USE_BAZEL || .travis/build-protoc.sh 3.0.0-beta-3
- $USE_BAZEL || go get github.com/golang/lint/golint
- $USE_BAZEL && .travis/install-bazel.sh 0.2.3
install:
- go get github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway
- go get github.com/gengo/grpc-gateway/runtime
- go get github.com/gengo/grpc-gateway/examples
- go get github.com/gengo/grpc-gateway/examples/server
- $USE_BAZEL || go get github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway
- $USE_BAZEL || go get github.com/gengo/grpc-gateway/runtime
- $USE_BAZEL || go get github.com/gengo/grpc-gateway/examples
- $USE_BAZEL || go get github.com/gengo/grpc-gateway/examples/server
script:
- if $USE_BAZEL; then bazel test //...; exit $?; fi

- make realclean && make examples
- if ! go version | grep devel; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi
- env GLOG_logtostderr=1 go test -race -v github.com/gengo/grpc-gateway/...
- golint github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/...
- golint github.com/gengo/grpc-gateway/runtime/...
- golint github.com/gengo/grpc-gateway/utilities/...
- golint -set_exit_status github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/...
- golint -set_exit_status github.com/gengo/grpc-gateway/runtime/...
- golint -set_exit_status 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/... || true
- go vet github.com/gengo/grpc-gateway/utilities/...
env:
global:
- "PATH=$PATH:$HOME/local/bin"
- "PATH=$PATH:$HOME/local/protobuf/bin"
23 changes: 23 additions & 0 deletions .travis/build-protoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/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/protobuf/bin/protoc-${protoc_version} --version 2>/dev/null; then
rm -rf $HOME/local/protobuf

mkdir -p $HOME/tmp
cd $HOME/tmp
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/protobuf --program-suffix=-${protoc_version}
make -j 4
make install
fi
ln -sf $HOME/local/protobuf/bin/protoc-${protoc_version} $HOME/local/protobuf/bin/protoc

echo \$ $HOME/local/protobuf/bin/protoc --version
$HOME/local/protobuf/bin/protoc --version
18 changes: 18 additions & 0 deletions .travis/install-bazel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh -eu
bazel_version=$1
if test -z "${bazel_version}"; then
echo "Usage: .travis/install-bazel.sh bazel-version"
exit 1
fi
if ! $HOME/local/bazel/bin/bazel version 2>/dev/null | grep "Build label ${bazel_version}"; then
rm -rf $HOME/local/bazel
wget "https://github.com/bazelbuild/bazel/releases/download/${bazel_version}/bazel-${bazel_version}-installer-linux-x86_64.sh"
bash ./bazel-${bazel_version}-installer-linux-x86_64.sh \
--prefix=$HOME/local/bazel \
--bazelrc=$HOME/local/bazel/etc/bazelrc
fi

ln -s $HOME/local/bazel/etc/bazelrc $HOME/.bazelrc
echo \$ $HOME/local/bazel/bin/bazel version
$HOME/local/bazel/bin/bazel version

0 comments on commit b9c7b5b

Please sign in to comment.