Skip to content
Closed
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
40 changes: 18 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,40 @@
sudo: false
sudo: required
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait... how did it work before with sudo: false? I didn't look closely enough earlier to notice it was running dpkg. The need for sudo is why I didn't mess with this earlier; I'd rather not lose that. It looks like it is possible to install into the home directory though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why...


language: java

addons:
apt:
packages:
- wget
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually necessary? We've already been using wget in make_dependencies.sh and the Travis documentation says wget is already installed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, it is an oversight...


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

env:
global:
- BAZEL_VERSION=0.9.0
- GRADLE_OPTS=-Xmx512m
- PROTOBUF_VERSION=3.5.1
- LDFLAGS=-L/tmp/protobuf/lib
- CXXFLAGS=-I/tmp/protobuf/include
- 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
- 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
- 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 @@ -47,11 +44,10 @@ notifications:

cache:
directories:
- /tmp/bazel
- /tmp/protobuf-${PROTOBUF_VERSION}
- /tmp/gradle-caches-modules-2
- /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-before_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
13 changes: 13 additions & 0 deletions buildscripts/travis-before_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
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-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