diff --git a/.travis.yml b/.travis.yml index bd6dcf60..df378b0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,46 @@ sudo: required + language: scala + jdk: - - oraclejdk8 +- oraclejdk8 + addons: apt: - packages: # Required for docker build - - net-tools -# These directories are cached to S3 at the end of the build + packages: + - net-tools + cache: directories: - - $HOME/.ivy2/cache - - $HOME/.sbt/boot/ + - "$HOME/.ivy2/cache" + - "$HOME/.sbt/boot/" + before_cache: - # Tricks to avoid unnecessary cache updates - find $HOME/.ivy2 -name "ivydata-*.properties" -delete - find $HOME/.sbt -name "*.lock" -delete + services: - docker + scala: - 2.11.8 + env: - DOCKER_DIR="../docker/" + script: - sbt ci + after_success: - bash <(curl -s https://codecov.io/bash) + +before_deploy: + - export JAR="target/scala-2.11/telemetry-streaming-assembly-0.1-SNAPSHOT.jar" + +deploy: + - provider: script + script: bash deploy.sh + skip_cleanup: true + on: + repo: mozilla/telemetry-streaming + all_branches: true diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 00000000..f4dcd26d --- /dev/null +++ b/deploy.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +if [[ -z "$JAR" ]]; then + echo "Missing arguments!" 1>&2 + exit 1 +fi + +TRAVIS_REPO_OWNER=${TRAVIS_REPO_SLUG%/*} +SLUG=${TRAVIS_REPO_SLUG#*/} +JAR_DIR="$TRAVIS_REPO_OWNER/$SLUG" +JAR_NAME="$SLUG.jar" +TXT_NAME="$SLUG.txt" + +sbt assembly + +if [[ -z "$TRAVIS_TAG" ]]; then + BRANCH_OR_TAG=$TRAVIS_BRANCH + ID=$TRAVIS_JOB_NUMBER +else + BRANCH_OR_TAG=tags + ID=$TRAVIS_TAG +fi + +CANONICAL_JAR="$JAR_DIR/$BRANCH_OR_TAG/$ID/$JAR_NAME" +echo $CANONICAL_JAR > $TXT_NAME + +mkdir -p $JAR_DIR/$BRANCH_OR_TAG/$ID +cp $JAR $CANONICAL_JAR +cp $JAR "$JAR_DIR/$BRANCH_OR_TAG/$JAR_NAME" +cp $TXT_NAME "$JAR_DIR/$BRANCH_OR_TAG/$TXT_NAME" + +curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash + +export ARTIFACTS_PERMISSIONS="public-read" +export ARTIFACTS_PATHS="$TRAVIS_REPO_OWNER/" +export ARTIFACTS_TARGET_PATHS="/$TRAVIS_REPO_OWNER/" +artifacts upload