symbiod/symbiod

View on GitHub
bin/travis-features

Summary

Maintainability
Test Coverage
#!/bin/bash

git clone https://github.com/symbiod/symbiod-features.git
cd symbiod-features

# Checkout corresponding features branch, if it exists
# It is required for cases, when we edit `bin/run` file, for example
# in specific branch, and we want to run its new implementation, instead of master.
# In addition we also detect the features docker image tag.
if [[ "$TRAVIS_BRANCH" == "master" ]]; then
  echo "Using master branch of features"
  echo "Current branch is master, using 'latest' tag"
  CURRENT_TAG="latest"
    APP_IMAGE_TAG="latest"
else
    APP_IMAGE_TAG=$TRAVIS_BRANCH
  if [ `git branch --list -r origin/$TRAVIS_BRANCH` ]; then
    echo "Using $TRAVIS_BRANCH branch of features"
    echo "Travis branch is $TRAVIS_BRANCH, using '$TRAVIS_BRANCH' tag"
    CURRENT_TAG=$TRAVIS_BRANCH 
    git checkout $TRAVIS_BRANCH
  else
    echo "There is no features branch for $TRAVIS_BRANCH, using master"
    echo "Current branch is master, using 'latest' tag"
    CURRENT_TAG="latest"
  fi
fi

export CURRENT_TAG
export APP_IMAGE_TAG
docker pull symbiod/symbiod:$APP_IMAGE_TAG
docker tag symbiod/symbiod:$APP_IMAGE_TAG registry.heroku.com/peaceful-refuge-95132/web:latest
bin/run