Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 11 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sudo: false
sudo: required

language: java

Expand All @@ -7,6 +7,11 @@ addons:
packages:
- wget

matrix:
include:
- env: TARGET="bazel"
- env: TARGET="gradle"

env:
global:
- BAZEL_VERSION=0.9.0
Expand All @@ -17,37 +22,19 @@ env:
- LD_LIBRARY_PATH=/tmp/protobuf/lib

before_install:
- mkdir -p $HOME/.gradle/caches &&
ln -s /tmp/gradle-caches-modules-2 $HOME/.gradle/caches/modules-2
- mkdir -p $HOME/.gradle &&
ln -s /tmp/gradle-wrapper $HOME/.gradle/wrapper
# Work around https://github.com/travis-ci/travis-ci/issues/2317
- if \[ "$TRAVIS_OS_NAME" = linux \]; then jdk_switcher use oraclejdk8; fi
- buildscripts/make_dependencies.sh # build protoc into /tmp/protobuf-${PROTOBUF_VERSION}
- ln -s "/tmp/protobuf-${PROTOBUF_VERSION}/$(uname -s)-$(uname -p)" /tmp/protobuf
- mkdir -p $HOME/.gradle
- echo "checkstyle.ignoreFailures=false" >> $HOME/.gradle/gradle.properties
- echo "failOnWarnings=true" >> $HOME/.gradle/gradle.properties
- echo "errorProne=true" >> $HOME/.gradle/gradle.properties
- mkdir -p /tmp/bazel
- wget -nc "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel_${BAZEL_VERSION}-linux-x86_64.deb" -P /tmp/bazel
- sudo dpkg -i "/tmp/bazel/bazel_${BAZEL_VERSION}-linux-x86_64.deb"
- buildscripts/travis-before_install.sh

install:
- ./gradlew assemble generateTestProto install
- pushd examples && ./gradlew build && popd
- pushd examples && mvn verify && popd
- buildscripts/travis-install.sh

before_script:
- test -z "$(git status --porcelain)" || (git status && echo Error Working directory is not clean. Forget to commit generated files? && false)

script:
- ./gradlew check :grpc-all:jacocoTestReport
- bazel build //...
- buildscripts/travis-script.sh

after_success:
- if \[ "$TRAVIS_OS_NAME" = linux \]; then ./gradlew :grpc-all:coveralls; fi
- bash <(curl -s https://codecov.io/bash)
- buildscripts/travis-after_success.sh

os:
- linux
Expand All @@ -63,6 +50,4 @@ cache:
- /tmp/gradle-wrapper

before_cache:
# The lock changes based on folder name; normally $HOME/.gradle/caches/modules-2/modules-2.lock
- rm /tmp/gradle-caches-modules-2/gradle-caches-modules-2.lock
- find $HOME/.gradle/wrapper -not -name "*-all.zip" -and -not -name "*-bin.zip" -delete
- buildscripts/travis-cache.sh
14 changes: 14 additions & 0 deletions buildscripts/travis-after_success.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -evx -o pipefail

if [ "${TARGET}" = "bazel" ]; then
echo 'NOOP'
fi

if [ "${TARGET}" = "gradle" ]; then
if [ "$TRAVIS_OS_NAME" = linux ]; then
./gradlew :grpc-all:coveralls
fi
bash <(curl -s https://codecov.io/bash)
fi
26 changes: 26 additions & 0 deletions buildscripts/travis-before_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -evx -o pipefail

if [ "${TARGET}" = "bazel" ]; then
mkdir -p /tmp/bazel
wget -nc "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel_${BAZEL_VERSION}-linux-x86_64.deb" -P /tmp/bazel
sudo dpkg -i "/tmp/bazel/bazel_${BAZEL_VERSION}-linux-x86_64.deb"
fi

if [ "${TARGET}" = "gradle" ]; then
mkdir -p $HOME/.gradle/caches &&
ln -s /tmp/gradle-caches-modules-2 $HOME/.gradle/caches/modules-2
mkdir -p $HOME/.gradle &&
ln -s /tmp/gradle-wrapper $HOME/.gradle/wrapper
# Work around https://github.com/travis-ci/travis-ci/issues/2317
if [ "${TRAVIS_OS_NAME}" = linux ]; then
source /opt/jdk_switcher/jdk_switcher.sh && jdk_switcher use oraclejdk8
fi
buildscripts/make_dependencies.sh # build protoc into /tmp/protobuf-${PROTOBUF_VERSION}
ln -s "/tmp/protobuf-${PROTOBUF_VERSION}/$(uname -s)-$(uname -p)" /tmp/protobuf
mkdir -p $HOME/.gradle
echo "checkstyle.ignoreFailures=false" >> $HOME/.gradle/gradle.properties
echo "failOnWarnings=true" >> $HOME/.gradle/gradle.properties
echo "errorProne=true" >> $HOME/.gradle/gradle.properties
fi
13 changes: 13 additions & 0 deletions buildscripts/travis-cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -evx -o pipefail

if [ "${TARGET}" = "bazel" ]; then
echo 'NOOP'
fi

if [ "${TARGET}" = "gradle" ]; then
# The lock changes based on folder name; normally $HOME/.gradle/caches/modules-2/modules-2.lock
rm /tmp/gradle-caches-modules-2/gradle-caches-modules-2.lock
find $HOME/.gradle/wrapper -not -name "*-all.zip" -and -not -name "*-bin.zip" -delete
fi
13 changes: 13 additions & 0 deletions buildscripts/travis-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -evx -o pipefail

if [ "${TARGET}" = "bazel" ]; then
echo 'NOOP'
fi

if [ "${TARGET}" = "gradle" ]; then
./gradlew assemble generateTestProto install
pushd examples && ./gradlew build && popd
pushd examples && mvn verify && popd
fi
11 changes: 11 additions & 0 deletions buildscripts/travis-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -evx -o pipefail

if [ "${TARGET}" = "bazel" ]; then
bazel build //...
fi

if [ "${TARGET}" = "gradle" ]; then
./gradlew check :grpc-all:jacocoTestReport
fi