Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Commit

Permalink
Setup travis ci deploy
Browse files Browse the repository at this point in the history
* Deploy changes according to ops config
* Use ops artifact bucket
* Latest release as well as tagged releases
* Latest master as well as per-build master
* Make single reusable file
  • Loading branch information
fbertsch committed Apr 25, 2018
1 parent 7294a37 commit 5847fb2
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 7 deletions.
33 changes: 26 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
37 changes: 37 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5847fb2

Please sign in to comment.