diff options
author | rghetia <rghetia@yahoo.com> | 2018-05-16 09:45:53 -0700 |
---|---|---|
committer | rghetia <rghetia@yahoo.com> | 2018-05-23 09:38:53 -0700 |
commit | 9f1a1bef457267ed789687b27b7340c9951ddb1a (patch) | |
tree | 9d32751579ba5cfa91032efd091f48b741b60bae /buildscripts | |
parent | a3b50ea4e27b0edbc976f10741fc3f4c14f7e9bc (diff) | |
download | opencensus-java-9f1a1bef457267ed789687b27b7340c9951ddb1a.tar.gz |
To bring parity with travis build add missing tasks to kokoro build.
- Each task is treated as separate job to run in parallel.
- single script linux_presumbit.sh performs all task based TASK env.
Diffstat (limited to 'buildscripts')
-rw-r--r-- | buildscripts/kokoro/linux_build.cfg | 19 | ||||
-rw-r--r-- | buildscripts/kokoro/linux_example_bazel.cfg | 10 | ||||
-rw-r--r-- | buildscripts/kokoro/linux_example_format.cfg | 9 | ||||
-rw-r--r-- | buildscripts/kokoro/linux_example_gradle.cfg | 10 | ||||
-rw-r--r-- | buildscripts/kokoro/linux_example_license.cfg | 10 | ||||
-rw-r--r-- | buildscripts/kokoro/linux_example_maven.cfg | 10 | ||||
-rw-r--r-- | buildscripts/kokoro/linux_framework.cfg | 10 | ||||
-rw-r--r-- | buildscripts/kokoro/linux_git_history.cfg | 10 | ||||
-rwxr-xr-x | buildscripts/kokoro/linux_presubmit.sh | 84 |
9 files changed, 172 insertions, 0 deletions
diff --git a/buildscripts/kokoro/linux_build.cfg b/buildscripts/kokoro/linux_build.cfg new file mode 100644 index 00000000..ddd15937 --- /dev/null +++ b/buildscripts/kokoro/linux_build.cfg @@ -0,0 +1,19 @@ +# Config file for child task BUILD + +env_vars { + key: "TASK" + value: "BUILD" +} + +# Location of the continuous shell script in repository. +build_file: "opencensus-java/buildscripts/kokoro/linux_presubmit.sh" +timeout_mins: 60 + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73495 + keyname: "codecov-auth-token" + } + } +} diff --git a/buildscripts/kokoro/linux_example_bazel.cfg b/buildscripts/kokoro/linux_example_bazel.cfg new file mode 100644 index 00000000..3f4c872e --- /dev/null +++ b/buildscripts/kokoro/linux_example_bazel.cfg @@ -0,0 +1,10 @@ +# Config file for child task BUILD_EXAMPLES_BAZEL + +env_vars { + key: "TASK" + value: "BUILD_EXAMPLES_BAZEL" +} + +# Location of the continuous shell script in repository. +build_file: "opencensus-java/buildscripts/kokoro/linux_presubmit.sh" +timeout_mins: 60 diff --git a/buildscripts/kokoro/linux_example_format.cfg b/buildscripts/kokoro/linux_example_format.cfg new file mode 100644 index 00000000..6f9a3dc1 --- /dev/null +++ b/buildscripts/kokoro/linux_example_format.cfg @@ -0,0 +1,9 @@ +# Config file for child task CHECK_EXAMPLES_FORMAT +env_vars { + key: "TASK" + value: "CHECK_EXAMPLES_FORMAT" +} + +# Location of the continuous shell script in repository. +build_file: "opencensus-java/buildscripts/kokoro/linux_presubmit.sh" +timeout_mins: 60 diff --git a/buildscripts/kokoro/linux_example_gradle.cfg b/buildscripts/kokoro/linux_example_gradle.cfg new file mode 100644 index 00000000..7c14df77 --- /dev/null +++ b/buildscripts/kokoro/linux_example_gradle.cfg @@ -0,0 +1,10 @@ +# Config file for child task BUILD_EXAMPLES_GRADLE + +env_vars { + key: "TASK" + value: "BUILD_EXAMPLES_GRADLE" +} + +# Location of the continuous shell script in repository. +build_file: "opencensus-java/buildscripts/kokoro/linux_presubmit.sh" +timeout_mins: 60 diff --git a/buildscripts/kokoro/linux_example_license.cfg b/buildscripts/kokoro/linux_example_license.cfg new file mode 100644 index 00000000..19cc67d0 --- /dev/null +++ b/buildscripts/kokoro/linux_example_license.cfg @@ -0,0 +1,10 @@ +# Config file for child task CHECK_EXAMPLES_LICENSE + +env_vars { + key: "TASK" + value: "CHECK_EXAMPLES_LICENSE" +} + +# Location of the continuous shell script in repository. +build_file: "opencensus-java/buildscripts/kokoro/linux_presubmit.sh" +timeout_mins: 60 diff --git a/buildscripts/kokoro/linux_example_maven.cfg b/buildscripts/kokoro/linux_example_maven.cfg new file mode 100644 index 00000000..98f4a3b9 --- /dev/null +++ b/buildscripts/kokoro/linux_example_maven.cfg @@ -0,0 +1,10 @@ +# Config file for child task BUILD_EXAMPLES_MAVEN + +env_vars { + key: "TASK" + value: "BUILD_EXAMPLES_MAVEN" +} + +# Location of the continuous shell script in repository. +build_file: "opencensus-java/buildscripts/kokoro/linux_presubmit.sh" +timeout_mins: 60 diff --git a/buildscripts/kokoro/linux_framework.cfg b/buildscripts/kokoro/linux_framework.cfg new file mode 100644 index 00000000..112fc206 --- /dev/null +++ b/buildscripts/kokoro/linux_framework.cfg @@ -0,0 +1,10 @@ +# Config file for child task CHECKER_FRAMEWORK + +env_vars { + key: "TASK" + value: "CHECKER_FRAMEWORK" +} + +# Location of the continuous shell script in repository. +build_file: "opencensus-java/buildscripts/kokoro/linux_presubmit.sh" +timeout_mins: 60 diff --git a/buildscripts/kokoro/linux_git_history.cfg b/buildscripts/kokoro/linux_git_history.cfg new file mode 100644 index 00000000..5677835a --- /dev/null +++ b/buildscripts/kokoro/linux_git_history.cfg @@ -0,0 +1,10 @@ +# Config file for child task CHECK_GIT_HISTORY + +env_vars { + key: "TASK" + value: "CHECK_GIT_HISTORY" +} + +# Location of the continuous shell script in repository. +build_file: "opencensus-java/buildscripts/kokoro/linux_presubmit.sh" +timeout_mins: 60 diff --git a/buildscripts/kokoro/linux_presubmit.sh b/buildscripts/kokoro/linux_presubmit.sh new file mode 100755 index 00000000..fa0d0627 --- /dev/null +++ b/buildscripts/kokoro/linux_presubmit.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +# This file is used for Linux builds. +# It expects TASK environment variable is defined. +# To run locally: +# ./buildscripts/kokoro/linux.sh + +# This script assumes `set -e`. Removing it may lead to undefined behavior. +set -exu -o pipefail + +# It would be nicer to use 'readlink -f' here but osx does not support it. +readonly OPENCENSUS_JAVA_DIR="$(cd "$(dirname "$0")"/../.. && pwd)" + +# cd to the root dir of opencensus-java +cd $(dirname $0)/../.. + +valid_tasks() { + echo "Valid tasks are" + echo "" + echo "- BUILD" + echo "- BUILD_EXAMPLES_BAZEL" + echo "- BUILD_EXAMPLES_GRADLE" + echo "- BUILD_EXAMPLES_MAVEN" + echo "- CHECKER_FRAMEWORK" + echo "- CHECK_EXAMPLES_FORMAT" + echo "- CHECK_EXAMPLES_LICENSE" + echo "- CHECK_GIT_HISTORY" +} + +if [[ ! -v TASK ]]; then + set +x + echo "TASK not set in environment" + valid_tasks + exit 1 +fi + +case "$TASK" in + "CHECK_GIT_HISTORY") + python ./scripts/check-git-history.py + ;; + "BUILD") + ./gradlew clean assemble --stacktrace + ./gradlew check :opencensus-all:jacocoTestReport + ./gradlew verGJF + + # Get token from file located at + # $KOKORO_KEYSTORE_DIR/73495_codecov-auth-token + if [ -f $KOKORO_KEYSTORE_DIR/73495_codecov-auth-token ] ; then + export CODECOV_TOKEN=`cat $KOKORO_KEYSTORE_DIR/73495_codecov-auth-token` + fi + if [[ ! -v CODECOV_TOKEN ]]; then + echo "Environment variable CODECOV_TOKEN not set" + exit 1 + fi + curl -s https://codecov.io/bash | bash + ;; + "CHECKER_FRAMEWORK") + ./gradlew clean assemble -PcheckerFramework=true + ;; + "CHECK_EXAMPLES_LICENSE") + curl -L -o checkstyle-8.0-all.jar https://sourceforge.net/projects/checkstyle/files/checkstyle/8.0/checkstyle-8.0-all.jar/download + java -DrootDir=. -jar checkstyle-8.0-all.jar -c buildscripts/checkstyle.xml examples/src/ + ;; + "CHECK_EXAMPLES_FORMAT") + curl -L -o google-java-format-1.5-all-deps.jar \ + https://github.com/google/google-java-format/releases/download/google-java-format-1.5/google-java-format-1.5-all-deps.jar + java -jar google-java-format-1.5-all-deps.jar --set-exit-if-changed --dry-run `find examples/src/ -name '*.java'` + ;; + "BUILD_EXAMPLES_GRADLE") + pushd examples && ./gradlew clean assemble --stacktrace && popd + ;; + "BUILD_EXAMPLES_MAVEN") + pushd examples && mvn clean package appassembler:assemble -e && popd + ;; + "BUILD_EXAMPLES_BAZEL") + pushd examples && bazel clean && bazel build :all && popd + ;; + *) + set +x + echo "Unknown task $TASK" + valid_tasks + exit 1 + ;; +esac |