From 0199a4d105d2aef50f8b05323e0ac072519dbeff Mon Sep 17 00:00:00 2001 From: Jerjou Cheng Date: Mon, 20 Mar 2017 15:38:05 -0700 Subject: [PATCH] Setup circleci ADC --- circle.yml | 16 ++++++++++++++++ travis.sh | 18 ++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 circle.yml diff --git a/circle.yml b/circle.yml new file mode 100644 index 00000000000..9acc2954151 --- /dev/null +++ b/circle.yml @@ -0,0 +1,16 @@ +machine: + java: + version: oraclejdk8 + environment: + chromedriver_path: /usr/local/bin/chromedriver +dependencies: + pre: + - sudo mkdir /opt/webdriver/ + - curl -LO https://github.com/mozilla/geckodriver/releases/download/v0.15.0/geckodriver-v0.15.0-linux64.tar.gz + && sudo tar -zxf geckodriver-*.tar.gz -C /opt/webdriver/ + - sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe" + - sudo apt-get update + - sudo apt-get install -t trusty-backports shellcheck +test: + override: + - bash ./travis.sh diff --git a/travis.sh b/travis.sh index c99a987dc8a..e2e271ba9a0 100755 --- a/travis.sh +++ b/travis.sh @@ -20,6 +20,14 @@ set -o pipefail shopt -s globstar +# Setup GCP application default credentials +if [[ $GCLOUD_SERVICE_KEY ]]; then + echo "$GCLOUD_SERVICE_KEY" | \ + base64 --decode --ignore-garbage > "${HOME}/google-cloud-service-key.json" + export GOOGLE_APPLICATION_CREDENTIALS="${HOME}/google-cloud-service-key.json" +fi + + SKIP_TESTS=false if [ -z "$GOOGLE_APPLICATION_CREDENTIALS" ] ; then SKIP_TESTS=true @@ -28,15 +36,16 @@ fi # Finds the closest parent dir that encompasses all changed files, and has a # pom.xml travis_changed_files_parent() { - [ -z "$TRAVIS_PULL_REQUEST" ] && return 0 # If we're not in a PR, forget it + # If we're not in a PR, forget it + [ -z "${TRAVIS_PULL_REQUEST-CI_PULL_REQUEST}" ] && return 0 ( set +e - changed="$(git diff --name-only "$TRAVIS_COMMIT" "$TRAVIS_BRANCH")" + changed="$(git diff --name-only "${TRAVIS_COMMIT-CIRCLE_SHA1}" "${TRAVIS_BRANCH-CIRCLE_BRANCH}")" if [ $? -ne 0 ]; then # Fall back to git head - changed="$(git diff --name-only "$(git rev-parse HEAD)" "$TRAVIS_BRANCH")" + changed="$(git diff --name-only "$(git rev-parse HEAD)" "${TRAVIS_BRANCH-CIRCLE_BRANCH}")" [ $? -ne 0 ] && return 0 # Give up. Just run everything. fi @@ -67,7 +76,8 @@ common_travis_dir="$(travis_changed_files_parent)" # Give Maven a bit more memory export MAVEN_OPTS='-XX:+PrintFlagsFinal -Xmx800m -Xms400m' -"${TRAVIS_BUILD_DIR}"/mvnw --batch-mode clean verify -e -DskipTests=$SKIP_TESTS | egrep -v "(^\[INFO\] Download|^\[INFO\].*skipping)" +"${TRAVIS_BUILD_DIR-$HOME/$CIRCLE_PROJECT_REPONAME}"/mvnw --batch-mode clean verify -e -DskipTests=$SKIP_TESTS | \ + egrep -v "(^\[INFO\] Download|^\[INFO\].*skipping)" [ -z "$common_travis_dir" ] || popd