Skip to content

Commit

Permalink
continuous delivery
Browse files Browse the repository at this point in the history
  • Loading branch information
Panciera committed Apr 13, 2016
1 parent aa2d3c1 commit 72e81bf
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Expand Up @@ -10,11 +10,18 @@ install:
- ./install.sh miniconda
- export PATH=$PWD/miniconda/bin:$PATH
- if [[ $TRAVIS_PYTHON_VERSION == '3.4' ]]; then pip install robotframework-python3; else pip install robotframework; fi
before_script:
- 'echo "TRAVIS_BRANCH: $TRAVIS_BRANCH"'
- 'echo "TRAVIS_TAG: $TRAVIS_TAG"'
- 'echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST"'
- '.travis/master.sh'
- '.travis/develop.sh'
script:
- nosetests tests -v --with-coverage --cover-erase --cover-package=bio_bits -a '!download'
- pybot tests/*.robot
after_success:
- coveralls
- .travis/push_release_tag.sh
notifications:
webhooks:
urls:
Expand Down
11 changes: 11 additions & 0 deletions .travis/current_version.py
@@ -0,0 +1,11 @@
#!/usr/bin/env python
# just print current value of __version__ in __init__.py
import os
from os.path import join, basename, dirname

THIS = dirname(__file__)
TRAVIS_REPO_SLUG = os.environ['TRAVIS_REPO_SLUG']
project_name = basename(TRAVIS_REPO_SLUG)

execfile(join(THIS, '../', project_name, '__init__.py'))
print __version__
11 changes: 11 additions & 0 deletions .travis/develop.sh
@@ -0,0 +1,11 @@
#!/bin/bash

if [ "${TRAVIS_BRANCH}" != "develop" ]
then
echo "Not develop branch. Skipping"
exit 0
fi

set -e

.travis/in_commit.sh CHANGELOG.rst docs/
15 changes: 15 additions & 0 deletions .travis/in_commit.sh
@@ -0,0 +1,15 @@
#!/bin/bash

# Exit if not found
set -e

# Files that were modified in this commit
FILES_CHANGED=$(git diff --name-only HEAD~1)
echo "Files changed in current commit:"
echo ${FILES_CHANGED}

# Exit if files
for file in $@
do
echo ${FILES_CHANGED} | grep -q $file || ( echo "$file not in commit"; exit 1 )
done
12 changes: 12 additions & 0 deletions .travis/master.sh
@@ -0,0 +1,12 @@
#!/bin/bash

if [ "${TRAVIS_BRANCH}" != "master" ]
then
echo "Not master branch. Skipping"
exit 0
fi

set -e

# Make sure changelog is updated
.travis/in_commit.sh CHANGELOG.rst
32 changes: 32 additions & 0 deletions .travis/push_release_tag.sh
@@ -0,0 +1,32 @@
#!/bin/bash

if [[ "${TRAVIS_PULL_REQUEST}" != "false" ]]
then
echo "This is a pull request. Skipping release process"
exit 0
fi

if [[ "${TRAVIS_BRANCH}" != "master" ]]
then
echo "Not master branch. Skipping release process"
exit 0
fi

if .travis/version_updated.sh >/dev/null 2>&1
then
echo "Version not updated. Skipping release process"
exit 0
fi

set -ev

git config --global user.email "builds@travis-ci.org"
git config --global user.name "Travis CI"
export GIT_TAG="v$(.travis/current_version.py)"
git tag $GIT_TAG -a -m "See [Changelog](CHANGELOG.rst) for all changes"
# Requires you first make a Personal Access tokens(https://github.com/settings/tokens)
# Then add GH_TOKEN to https://travis-ci.org/user/project/settings
export PROJECT=$(basename ${TRAVIS_REPO_SLUG})
set +v
echo "Pushing $GIT_TAG"
git push --quiet https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git $GIT_TAG
4 changes: 4 additions & 0 deletions .travis/version_updated.sh
@@ -0,0 +1,4 @@
#!/bin/bash

# Make sure version is changed
git diff $(basename $TRAVIS_REPO_SLUG)/__init__.py | grep -q '^.__version__' || (echo "Version was not updated"; exit 1)
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -2,6 +2,11 @@
CHANGELOG
=========

Version 1.4.0
-------------
* Switched to conda install
* Added continuous delivery

Version 1.3.2
-------------

Expand Down

0 comments on commit 72e81bf

Please sign in to comment.