Skip to content

Commit

Permalink
Merge pull request #97 from CitrineInformatics/feature/release-proces…
Browse files Browse the repository at this point in the history
…s-documentation

Describe the release process in the contributing.md
  • Loading branch information
maxhutch authored Apr 22, 2020
2 parents 828e03c + 7a50d83 commit 8779844
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ script:
- flake8 gemd
- cd docs; make html; cd ..;
- touch ./docs/_build/html/.nojekyll
- if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then bash ./scripts/validate-version-bump.sh; fi
deploy:
- provider: pages
skip_cleanup: true
Expand Down
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,21 @@ This project follows [PEP8](https://www.python.org/dev/peps/pep-0008/), with the
* Maximum line length is 99 characters

For additional (non-binding) inspiration, check out the [Google Python Style Guide](https://github.com/google/styleguide/blob/gh-pages/pyguide.md).

## Branching strategy

This project currently follows a [feature branch workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow) (i.e. _masterflow_):
* Feature branches and bugfixes are branched off of master and then opened as PRs into master
* Every PR must contain a version bump following [semantic versioning](https://semver.org/)
* Backport branches for historical versions are created as-needed off of master; backports are branched off of and merged into them

During periods of rapid development activity, the branching strategy may change to accomodate it, but it will be kept up to date here.

## Release process

The master branch **does not** continuously deploy to [pypi](https://pypi.org/project/gemd/).
Rather, releases are cut explicitly by using [Github's releases](https://github.com/CitrineInformatics/gemd-python/releases) and creating a tag that matches the version number of the commit being released.
Travis will trigger the deploy due to the addition of the tag.
Only commits on the **master** or backports branches can be released, but it need not be the most recent commit on the branch.
The tests contained within this repository are sufficient to verify a release.

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 -eu

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 +eu)" 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 @@ -36,7 +36,7 @@ def run(self):


setup(name='gemd',
version='0.6.3',
version='0.6.4',
url='http://github.com/CitrineInformatics/gemd-python',
description="Python binding for Citrine's GEMD data model",
author='Max Hutchinson',
Expand Down

0 comments on commit 8779844

Please sign in to comment.