aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/travis_script
diff options
context:
space:
mode:
authorStefan Schmidt <ubschmidt2@users.noreply.github.com>2017-10-31 03:54:25 +0100
committerGitHub <noreply@github.com>2017-10-31 03:54:25 +0100
commit4a03931492e791ad155d5ea0f4c97702a781b339 (patch)
treef42b18149bf1cd744c6c95235f07138a3023f0c5 /scripts/travis_script
parentb09a163af2a6406798fa5cdf73f94cd829a2ec9e (diff)
downloadplatform_external_opencensus-java-4a03931492e791ad155d5ea0f4c97702a781b339.tar.gz
platform_external_opencensus-java-4a03931492e791ad155d5ea0f4c97702a781b339.tar.bz2
platform_external_opencensus-java-4a03931492e791ad155d5ea0f4c97702a781b339.zip
Move the Travis "script" from .travis.yml to a separate file. (#747)
* Move the Travis "script" from .travis.yml to a separate file. * Set -e -v. * Replace "jdk_switcher use" as it would require sudo. * Source jdk_switcher.sh on linux only.
Diffstat (limited to 'scripts/travis_script')
-rwxr-xr-xscripts/travis_script54
1 files changed, 54 insertions, 0 deletions
diff --git a/scripts/travis_script b/scripts/travis_script
new file mode 100755
index 00000000..74b50bf0
--- /dev/null
+++ b/scripts/travis_script
@@ -0,0 +1,54 @@
+#!/bin/bash
+#
+# Travis build script, cf.
+# https://docs.travis-ci.com/user/customizing-the-build/#Implementing-Complex-Build-Steps.
+
+set -o errexit
+set -o xtrace
+
+case "$TASK" in
+ "CHECK_GIT_HISTORY")
+ python "$(dirname "$0")"/check-git-history.py
+ ;;
+ "BUILD")
+ case "$TRAVIS_OS_NAME" in
+ "linux")
+ source /opt/jdk_switcher/jdk_switcher.sh
+ export JAVA8_HOME="$(jdk_switcher home oraclejdk8)"
+ case "$TRAVIS_JDK_VERSION" in
+ "oraclejdk8")
+ export JAVA_HOMES="$(jdk_switcher home openjdk6)/jre:$(jdk_switcher home openjdk7)/jre:$(jdk_switcher home oraclejdk8)/jre:$(jdk_switcher home oraclejdk9)"
+ ./gradlew clean assemble --stacktrace
+ ./gradlew check :opencensus-all:jacocoTestReport
+ ;;
+ "openjdk7")
+ # "./gradlew classes testClasses" is a workaround for
+ # https://github.com/gradle/gradle/issues/2421.
+ # See https://github.com/gradle/gradle/issues/2421#issuecomment-319916874.
+ JAVA_HOME="$(jdk_switcher home openjdk8)" ./gradlew classes testClasses
+ ./gradlew clean assemble --stacktrace
+ ./gradlew check
+ ;;
+ *)
+ echo "Unknown JDK version $TRAVIS_JDK_VERSION"
+ exit 1
+ ;;
+ esac
+ ;;
+ "osx")
+ # OS X is a separate case, because the JDK version is determined by the OS X image:
+ # https://docs.travis-ci.com/user/reference/osx/#JDK-and-OS-X
+ ./gradlew clean assemble --stacktrace
+ ./gradlew check
+ ;;
+ *)
+ echo "Unknown OS name $TRAVIS_OS_NAME"
+ exit 1
+ ;;
+ esac
+ ;;
+ *)
+ echo "Unknown task $TASK"
+ exit 1
+ ;;
+esac