Skip to content

Commit

Permalink
Setup circleci ADC
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerjou Cheng committed Mar 21, 2017
1 parent dc1a6c8 commit 0199a4d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
16 changes: 16 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 14 additions & 4 deletions travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 0199a4d

Please sign in to comment.