diff --git a/.travis.yml b/.travis.yml index 9777a5c..f436505 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ sudo: false language: python -install: "pip install flake8 ." +install: pip install -r requirements-dev.txt . script: - - flake8 testimony + - make lint - make test notifications: irc: "chat.freenode.net#robottelo" diff --git a/MANIFEST.in b/MANIFEST.in index a5021c6..75d1aa7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1 @@ -include README.rst -include LICENSE +include LICENSE README.rst VERSION diff --git a/Makefile b/Makefile index 929ca77..7366091 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,15 @@ +lint: + flake8 testimony + +package: + python setup.py sdist bdist_wheel --universal + +package-clean: + rm -rf build dist testimony.egg-info + +publish: package + twine upload dist/* test: @./tests/test_testimony.sh | diff tests/sample_output.txt - -.PHONY: test +.PHONY: package package-clean publish test diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..af0b7dd --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.0.6 diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..15ffaa3 --- /dev/null +++ b/release.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# +# Test Testimony for sanity. If all is well, generate a new commit, tag it, and +# print instructions for further steps to take. +# +# NOTE: This script should be run from the repository root directory. Also in +# order to actually release to PyPI a proper `.pypirc` file should be already +# setup, for more information check +# https://docs.python.org/3/distutils/packageindex.html#the-pypirc-file +# +set -euo pipefail + +# Make sure local fork is updated +git fetch -p --all +git checkout master +git merge --ff-only upstream/master + +OLD_VERSION="$(git tag --list | sort -V | tail -n 1)" +MAJOR_VERSION="$(echo ${OLD_VERSION} | cut -d . -f 1)" +MINOR_VERSION="$(echo ${OLD_VERSION} | cut -d . -f 2)" +NEW_VERSION="${MAJOR_VERSION}.$((${MINOR_VERSION} + 1)).0" + +# Bump version number +echo "${NEW_VERSION}" > VERSION + +# Generate the package +make package-clean package + +# Sanity check Testimony packages on both Python 2 and Python 3 +for python in python{2,3}; do + venv="$(mktemp --directory)" + virtualenv -p "${python}" "${venv}" + set +u + source "${venv}/bin/activate" + set -u + for dist in dist/*; do + ls "${dist}" + pip install --quiet -U pip + pip install --quiet "${dist}" + python -c "import testimony" 1>/dev/null + make test + pip uninstall --quiet --yes testimony + done + set +u + deactivate + set -u + rm -rf "${venv}" +done + +# Get the changes from last release and commit +git add VERSION +git commit -m "Release version ${NEW_VERSION}" \ + -m "Shortlog of commits since last release:" \ + -m "$(git shortlog ${OLD_VERSION}.. | sed 's/^./ &/')" + +# Tag with the new version +git tag "${NEW_VERSION}" + +fmt <