Skip to content

Commit

Permalink
Updated Travis CI
Browse files Browse the repository at this point in the history
Update Travis CI 2
  • Loading branch information
f0rmiga committed Apr 16, 2018
1 parent 7fb04e6 commit 7dbea4a
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 27 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ _output/
.idea

# Bazel.
bazel-*
bazel-bin
bazel-genfiles
bazel-grpc-gateway
bazel-out
bazel-testlogs
60 changes: 34 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,49 @@
language: go
sudo: false
go:
- 1.9.x
- 1.10.x
- master
- 1.9.x
- 1.10.x
- master
go_import_path: github.com/grpc-ecosystem/grpc-gateway
cache:
directories:
- $HOME/local
- ${TRAVIS_BUILD_DIR}/examples/browser/node_modules
- $HOME/local
- ${TRAVIS_BUILD_DIR}/examples/browser/node_modules
- $HOME/.cache/_grpc_gateway_bazel
before_install:
- ./.travis/install-protoc.sh 3.1.0
- ./.travis/install-swagger-codegen.sh 2.2.2
- nvm install v6.1 && nvm use v6.1 && node --version
- go get github.com/golang/lint/golint
- go get github.com/dghubble/sling
- go get github.com/go-resty/resty
- if [ "${USE_BAZEL}" = true ]; then ./.travis/install-bazel.sh 0.12.0; fi
- if [ -z "${USE_BAZEL}" ]; then ./.travis/install-protoc.sh 3.1.0; fi
- if [ -z "${USE_BAZEL}" ]; then ./.travis/install-swagger-codegen.sh 2.2.2; fi
- if [ -z "${USE_BAZEL}" ]; then nvm install v6.1 && nvm use v6.1 && node --version; fi
- go get github.com/golang/lint/golint
- go get github.com/dghubble/sling
- go get github.com/go-resty/resty
install:
- go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
- go get github.com/grpc-ecosystem/grpc-gateway/runtime
- go get github.com/grpc-ecosystem/grpc-gateway/examples
- go get github.com/grpc-ecosystem/grpc-gateway/examples/server
- go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
- go get github.com/grpc-ecosystem/grpc-gateway/runtime
- go get github.com/grpc-ecosystem/grpc-gateway/examples
- go get github.com/grpc-ecosystem/grpc-gateway/examples/server
before_script:
- sh -c 'cd examples/browser && npm install'
- sh -c 'cd examples/browser && npm install'
script:
- make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar"
- if (go version | grep -q "${GO_VERSION_TO_DIFF_TEST}") && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi
- env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/...
- if (go version | grep -q "${GO_VERSION_TO_DIFF_TEST}") && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then env GLOG_logtostderr=1 ./bin/coverage; fi
- make lint
- sh -c 'cd examples/browser && node ./node_modules/gulp/bin/gulp'
- if [ "${USE_BAZEL}" = true ]; then ./.travis/bazel-build.sh; fi
- if [ "${USE_BAZEL}" = true ]; then ./.travis/bazel-test.sh; fi
- if [ -z "${USE_BAZEL}" ]; then make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar"; fi
- if [ -z "${USE_BAZEL}" ] && (go version | grep -q "${GO_VERSION_TO_DIFF_TEST}") && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi
- if [ -z "${USE_BAZEL}" ]; then env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/...; fi
- if [ -z "${USE_BAZEL}" ]; then make lint; fi
- if [ -z "${USE_BAZEL}" ]; then sh -c 'cd examples/browser && node ./node_modules/gulp/bin/gulp'; fi
- if (go version | grep -q "${GO_VERSION_TO_DIFF_TEST}") && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then env GLOG_logtostderr=1 ./bin/coverage; fi
after_success:
- bash <(curl -s https://codecov.io/bash)
env:
global:
- "PATH=$PATH:$HOME/local/bin"
- GO_VERSION_TO_DIFF_TEST="go version go1\.10\.[0-9]\+ linux/amd64"
- "PATH=$PATH:$HOME/local/bin"
- GO_VERSION_TO_DIFF_TEST="go version go1\.10\.[0-9]\+ linux/amd64"
matrix:
- GATEWAY_PLUGIN_FLAGS=
- GATEWAY_PLUGIN_FLAGS=request_context=false
- GATEWAY_PLUGIN_FLAGS=
- GATEWAY_PLUGIN_FLAGS=request_context=false
matrix:
include:
- go: master
env: USE_BAZEL=true
10 changes: 10 additions & 0 deletions .travis/bazel-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh -eu

bazel \
--batch \
--output_base=$HOME/.cache/_grpc_gateway_bazel \
--host_jvm_args=-Xmx500m \
--host_jvm_args=-Xms500m \
build \
--local_resources=400,1,1.0 \
//...
12 changes: 12 additions & 0 deletions .travis/bazel-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh -eu

bazel \
--batch \
--output_base=$HOME/.cache/_grpc_gateway_bazel \
--host_jvm_args=-Xmx500m \
--host_jvm_args=-Xms500m \
test \
--local_resources=400,1,1.0 \
--test_output=errors \
--features=race \
//...
20 changes: 20 additions & 0 deletions .travis/install-bazel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh -eu

bazel_version=$1

if test -z "${bazel_version}"; then
echo "Usage: .travis/install-bazel.sh bazel-version"
exit 1
fi

if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
OS=darwin
else
OS=linux
fi

filename=bazel-${bazel_version}-installer-${OS}-x86_64.sh
wget https://github.com/bazelbuild/bazel/releases/download/${bazel_version}/${filename}
chmod +x $filename
./$filename --user
rm -f $filename

0 comments on commit 7dbea4a

Please sign in to comment.