From e8fca42845fafc5e05d568102d3cf3bcf80935d8 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Sun, 6 Sep 2015 14:46:10 +0100 Subject: [PATCH] Updated travis scripts in order to auto-release new version is all tests went OK. --- .gitignore | 1 + .travis.yml | 62 +++++++++++++++++++++++++++++++++++++++++++++++------ release.sh | 43 +++++++++++++++++-------------------- setup.cfg | 1 + setup.py | 11 +++++----- tox.ini | 4 +--- 6 files changed, 83 insertions(+), 39 deletions(-) diff --git a/.gitignore b/.gitignore index 9a4c794..c9acb56 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ dist *.egg .tox ~*.* +build/ diff --git a/.travis.yml b/.travis.yml index 0e2da31..706954c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,59 @@ language: python sudo: false -env: - - TOX_ENV=py26 - - TOX_ENV=py27 - - TOX_ENV=py33 - - TOX_ENV=py34 +os: +- linux +python: +- '2.7' +- '3.3' +- '3.4' install: - - pip install tox +- pip -q install coveralls six autopep8 script: - - tox -e $TOX_ENV +- curl --silent -Lo travis_after_all.py https://raw.github.com/pycontribs/travis_after_all/master/travis_after_all.py && travis_wait python setup.py prerelease test +- export PACKAGE_VERSION=$(python -c "from wstools.version import __version__; print(__version__)") +after_success: + - python travis_after_all.py + - export $(cat .to_export_back) + - | + if [ "$BUILD_LEADER" = "YES" ]; then + if [ "$BUILD_AGGREGATE_STATUS" = "others_succeeded" ]; then + echo "All jobs succeeded! PUBLISHING..." + else + echo "Some jobs failed" + fi + fi + - coveralls + - python setup.py sdist bdist_wheel +after_failure: + - python travis_after_all.py + - export $(cat .to_export_back) + - | + if [ "$BUILD_LEADER" = "YES" ]; then + if [ "$BUILD_AGGREGATE_STATUS" = "others_failed" ]; then + echo "All jobs failed" + else + echo "Some jobs failed" + fi + fi +after_script: + - echo leader=$BUILD_LEADER status=$BUILD_AGGREGATE_STATUS +branches: + only: + - master +before_deploy: + - echo "before deploy..." +deploy: + - provider: releases + api_key: + - secure: "gr9iOcQjdoAyUAim6FWKzJI9MBaJo9XKfGQGu7wdPXUFhg80Rp6GLJsowP+aU94NjXM1UQlVHDAy627WtjBlLH2SvmVEIIr7+UKBopBYuXG5jJ1m3wOZE+4f1Pqe9bqFc1DxgucqE8qF0sC24fIbNM2ToeyYrxrS6RoL2gRrX2I=" + file: "dist/jira-$PACKAGE_VERSION.tar.gz" + skip_cleanup: true + on: + condition: "$BUILD_LEADER = YES" + - provider: pypi + user: sorin + password: + secure: "E0cjANF7SLBdYrsnWLK8X/xWznqkF0JrP/DVfDazPzUYH6ynFeneyofzNJQPLTLsqe1eKXhuUJ/Sbl+RHFB0ySo/j/7NfYd/9pm8hpUkGCvR09IwtvMLgWKp3k10NWab03o2GOkSJSrLvZofyZBGR40wwu2O9uXPCb2rvucCGbw=" + distributions: "sdist bdist_wheel" + on: + condition: "$BUILD_LEADER = YES" diff --git a/release.sh b/release.sh index b26b8be..b656f36 100755 --- a/release.sh +++ b/release.sh @@ -1,20 +1,9 @@ #!/bin/bash set -ex -VERSION=$(python -c "from src.wstools.version import __version__ ; print __version__") +VERSION=$(python -c "from wstools.version import __version__ ; print __version__") echo Preparing to release version $VERSION - -#source tox - -#pip install --upgrade pep8 autopep8 docutils - -echo === Testings === -if ! python setup.py test; then - echo "The test suite failed. Fix it!" - exit 1 -fi - echo === Chechink that all changes are commited and pushed === git pull -u @@ -34,23 +23,31 @@ git diff exit 1 fi +git log --date=short --pretty=format:"%cd %s" > CHANGELOG +git diff -echo "Please don't run this as a user. This generates a new release for PyPI. Press ^C to exit or Enter to continue." -read +if [ -v PS1 ] ; then + echo "Automatic deployment" +else + echo "Please don't run this as a user. This generates a new release for PyPI. Press ^C to exit or Enter to continue." + read +fi +git add CHANGELOG +git commit -a "Auto-generating release notes." -# Clear old distutils stuff -rm -rf build dist MANIFEST &> /dev/null +git tag -f -a $VERSION -m "Version $VERSION" +git tag -f -a RELEASE -m "Current RELEASE" -# Build installers, etc. and upload to PyPI -# python setup.py register sdist bdist_wininst upload +NEW_VERSION="${VERSION%.*}.$((${VERSION##*.}+1))" +set -ex +sed -i ~ "s/${VERSION}/${NEW_VERSION}/" wstools/version.py -#python setup.py register sdist build_sphinx upload upload_sphinx -python setup.py register sdist upload +git commit -a "Auto-increasing the version number after a release." -git tag -f -a $VERSION -m "Version $VERSION" -git tag -f -a RELEASE -m "Current RELEASE" +# disables because this is done only by Travis CI from now, which calls this script after that. +#python setup.py register sdist bdist_wheel build_sphinx upload_docs upload --sign -git push origin --tags +git push --force origin --tags echo "done." diff --git a/setup.cfg b/setup.cfg index 87e0b3e..64fb122 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,6 +16,7 @@ upload-dir = docs/build/html norecursedirs = . .svn jira _build tmp* lib/third lib *.egg bin distutils build docs demo python_files = *.py addopts = -p no:xdist --ignore=setup.py --tb=long -rsxX -v --maxfail=10 --pep8 tests +timeout=60 # --maxfail=2 -n4 # -n4 runs up to 4 parallel procs # --maxfail=2 fail fast, dude diff --git a/setup.py b/setup.py index da10547..460b5ae 100644 --- a/setup.py +++ b/setup.py @@ -129,6 +129,7 @@ class PreRelease(Command): raise RuntimeError( "Current version of the package is equal or lower than the already published ones (PyPi). Increse version to be able to pass prerelease stage.") +requires = ['autopep8', 'six', 'pep8', 'pytest-cov', 'pytest-pep8', 'setuptools', 'pytest', 'pytest-timeout'] setup( name=NAME, @@ -136,7 +137,9 @@ setup( cmdclass={'test': PyTest, 'release': Release, 'prerelease': PreRelease}, packages=find_packages(exclude=['tests']), include_package_data=True, - install_requires=['docutils','six'], + tests_require=requires, + setup_requires=requires, + install_requires=requires, license='BSD', description="WSDL parsing services package for Web Services for Python. see" + url, @@ -152,18 +155,14 @@ setup( keywords='api wstools wdsl web', classifiers=[ 'Programming Language :: Python', - 'Programming Language :: Python :: 2.5', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Development Status :: 4 - Beta', + 'Development Status :: 5 - Production/Stable', 'Environment :: Other Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Topic :: Software Development :: Libraries :: Python Modules', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Topic :: Internet :: WWW/HTTP', diff --git a/tox.ini b/tox.ini index 672cd6c..30e5957 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 1.3 -envlist = py26,py27,py34,flake8 +envlist = py27,py34,flake8 [testenv] deps= @@ -12,8 +12,6 @@ commands= bash -c "coveralls || true" whitelist_externals=bash -[testenv:py26] - [testenv:py27] [testenv:py33]