From 72e81bf84c57e18de9510968207dae70d1f85631 Mon Sep 17 00:00:00 2001 From: Panciera Date: Wed, 13 Apr 2016 10:16:44 -0400 Subject: [PATCH 1/2] continuous delivery --- .travis.yml | 7 +++++++ .travis/current_version.py | 11 +++++++++++ .travis/develop.sh | 11 +++++++++++ .travis/in_commit.sh | 15 +++++++++++++++ .travis/master.sh | 12 ++++++++++++ .travis/push_release_tag.sh | 32 ++++++++++++++++++++++++++++++++ .travis/version_updated.sh | 4 ++++ CHANGELOG.rst | 5 +++++ 8 files changed, 97 insertions(+) create mode 100755 .travis/current_version.py create mode 100755 .travis/develop.sh create mode 100755 .travis/in_commit.sh create mode 100755 .travis/master.sh create mode 100755 .travis/push_release_tag.sh create mode 100755 .travis/version_updated.sh diff --git a/.travis.yml b/.travis.yml index 4fcee3d..aac91dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/.travis/current_version.py b/.travis/current_version.py new file mode 100755 index 0000000..a39f01b --- /dev/null +++ b/.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__ diff --git a/.travis/develop.sh b/.travis/develop.sh new file mode 100755 index 0000000..a3898d3 --- /dev/null +++ b/.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/ diff --git a/.travis/in_commit.sh b/.travis/in_commit.sh new file mode 100755 index 0000000..009d0c5 --- /dev/null +++ b/.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 diff --git a/.travis/master.sh b/.travis/master.sh new file mode 100755 index 0000000..90ba293 --- /dev/null +++ b/.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 diff --git a/.travis/push_release_tag.sh b/.travis/push_release_tag.sh new file mode 100755 index 0000000..2b49e02 --- /dev/null +++ b/.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 diff --git a/.travis/version_updated.sh b/.travis/version_updated.sh new file mode 100755 index 0000000..052918e --- /dev/null +++ b/.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) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c3d9b6d..6afcef4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,11 @@ CHANGELOG ========= +Version 1.4.0 +------------- +* Switched to conda install +* Added continuous delivery + Version 1.3.2 ------------- From 46fdea2a7fac41236b98821156aab967df549852 Mon Sep 17 00:00:00 2001 From: Panciera Date: Wed, 13 Apr 2016 11:47:01 -0400 Subject: [PATCH 2/2] show pybot report on travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index aac91dc..8114a1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ before_script: script: - nosetests tests -v --with-coverage --cover-erase --cover-package=bio_bits -a '!download' - pybot tests/*.robot + - cat /home/travis/build/VDBWRAIR/bio_bits/output.xml after_success: - coveralls - .travis/push_release_tag.sh