Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Please briefly explain the goal of the changes/this PR.
- [ ] I have added tests for 100% coverage
- [ ] I have written Numpy-style docstrings for every method and class.
- [ ] I have communicated the downstream consequences of the PR to others.
- [ ] I have bumped the version in setup.py
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ script:
- flake8 src
- cd docs; make html; cd ..;
- touch ./docs/_build/html/.nojekyll
- ./scripts/validate-version-bump.sh
deploy:
- provider: pages
skip_cleanup: true
Expand Down
59 changes: 59 additions & 0 deletions scripts/validate-version-bump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

set -eux

extract_version() {
sed -En "s/.*version='([0-9]+\.[0-9]+\.[0-9]+).*/\1/p" <<< "$@"
}

extract_major() {
sed -En "s/([0-9]+).*/\1/p" <<< "$1"
}

extract_minor() {
sed -En "s/.*\.([0-9]+)\..*/\1/p" <<< "$1"
}

extract_patch() {
sed -En "s/.*([0-9])/\1/p" <<< "$1"
}

trap "$(set +eux)" EXIT

CURRENT="$(extract_version $(cat setup.py))"
MASTER="$(extract_version $(git show master:setup.py))"

CURRENT_MAJOR="$(extract_major ${CURRENT})"
CURRENT_MINOR="$(extract_minor ${CURRENT})"
CURRENT_PATCH="$(extract_patch ${CURRENT})"

MASTER_MAJOR="$(extract_major ${MASTER})"
MASTER_MINOR="$(extract_minor ${MASTER})"
MASTER_PATCH="$(extract_patch ${MASTER})"

if [ "${CURRENT_MAJOR}" -gt "${MASTER_MAJOR}" ]; then
echo "major version bump"
exit 0
elif [ "${CURRENT_MAJOR}" -lt "${MASTER_MAJOR}" ]; then
echo "error - major version decreased!"
exit 1
else
if [ "${CURRENT_MINOR}" -gt "${MASTER_MINOR}" ]; then
echo "minor version bump"
exit 0
elif [ "${CURRENT_MINOR}" -lt "${MASTER_MINOR}" ]; then
echo "error - minor version decreased!"
exit 2
else
if [ "${CURRENT_PATCH}" -gt "${MASTER_PATCH}" ]; then
echo "patch version bump"
exit 0
elif [ "${CURRENT_PATCH}" -lt "${MASTER_PATCH}" ]; then
echo "error - patch version decreased!"
exit 3
else
echo "error - version unchanged!"
exit 4
fi
fi
fi
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def run(self):


setup(name='citrine',
version='0.9.1',
version='0.10.0',
url='http://github.com/CitrineInformatics/citrine-python',
description='Python library for the Citrine Platform',
author='Andrew Millspaugh',
Expand Down