-
Notifications
You must be signed in to change notification settings - Fork 3.9k
bazel,travis: add bazel build checking #3925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,43 +1,40 @@ | ||
| sudo: false | ||
| sudo: required | ||
|
|
||
| language: java | ||
|
|
||
| addons: | ||
| apt: | ||
| packages: | ||
| - wget | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
@@ -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 | ||
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
There was a problem hiding this comment.
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 runningdpkg. 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.There was a problem hiding this comment.
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...