From 4540ef48621fed793ed63fe141cd8b4af4d5d708 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Fri, 6 Mar 2020 17:07:02 +0000 Subject: Add conditional cibuildwheel use and release script --- .travis.yml | 25 ++++++++++++++++++------- .travis_deploy.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 .travis_deploy.sh diff --git a/.travis.yml b/.travis.yml index 0950aa6..f3d5bd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -# Travis CI configuration for GenSVM +# Travis CI configuration for PyGenSVM jobs: include: @@ -31,10 +31,12 @@ jobs: env: global: - # - No longer actively maintaining gensvm for Python 2.7 - # - Skipping 3.5 for now because scikit-learn is not available as wheel - # anymore, and this breaks testing. + - TWINE_USERNAME=__token__ + - secure: "Mfu8zoi/Zxaao84+OiDD9Cy+Dzl+neB2+OFL4WK7NM40vtfHwpN7EMUaQN9FscizQqZZbsn3csCZ7+Lpgcgpq88dkFpsLbDJuX3DXUXmNZDjskzetbnE+IzOMqzugiIkm7tDSqoMpjkvtOOpTnhWQj/06BQy17NsTLZvtZGsqeoDFZby6PgfpQlU//RO+qcSds47lcQnw4jhgr5x0xPvczKL5FIY7Xwrv/C5kYhC14fadoKAdJI9tmD5lzlf2iW4dMYnB3gO4zlT5PUzhpO5yTpVIenv84d/LJUITBmVocbhzkYt4NIRIuuQAtLQ3STD/BJN+HyzhZKYhlxSgd6kKCjimJjGrv6ssemXnVn6DZNyDvY7bFuWNv1Xo/I3+XQAN/BGAGpPsgoMn6c3PwCbz/1K1DyJmcx1nkb8OtWFvu1QyzTk9ZLRg8S+QB5ouHYzd0P6q6TBs3CMIOHO9lEd5UmtNLHobqlvVOHCkDgUwkC/VHR+2UbkriUx2o5L96QyrcnaVqIsdX1XpwFtwcG/HjG/s+3qAvIHOQN55m8IkTsVCylF8zOzX0YBhPGG+H9YxshDZGu7uWFFSLFMn5GIt+50bSQ33nsrswUvxgMz926RA54K0NTn9HXy8Q9JCikA/HopS6as4id2s8u7Umdhu1lgrAxW3BEgX35VsH2Vw9M=" + + # PyGenSVM is Python3.6+ - CIBW_SKIP="cp27-* cp35-*" + # Run the unit tests on the wheels that are created - CIBW_TEST_REQUIRES="numpy Cython" - CIBW_TEST_COMMAND="python -VV && python -m unittest discover -f -s {project}/test" @@ -45,6 +47,15 @@ install: - $PYTHON -m unittest discover -v -f -s ./test script: - - $PIP install cibuildwheel==1.0.0 - - cibuildwheel --output-dir wheelhouse - - ls wheelhouse + - if [[ "${TRAVIS_TAG:-}" =~ ^v[0-9]\.[0-9]\.[0-9].*$ ]]; then + $PIP install cibuildwheel==1.0.0 && cibuildwheel --output-dir wheelhouse && ls -1 wheelhouse; + else + echo "No valid git tag present so not running cibuildwheel."; + fi + +deploy: + skip_cleanup: true + provider: script + script: bash .travis_deploy.sh "${TRAVIS_TAG}" "${PIP}" "${PYTHON}" + on: + tags: true diff --git a/.travis_deploy.sh b/.travis_deploy.sh new file mode 100644 index 0000000..194be3d --- /dev/null +++ b/.travis_deploy.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# +# Simple travis deploy script. +# +# This was added because for some reason the inline bash command failed on +# Windows. See: +# https://travis-ci.org/alan-turing-institute/CleverCSV/jobs/618669819 +# + +set -e +set -x + +TRAVIS_TAG="$1" +PIP="$2" +PYTHON="$3" + +if [[ "${TRAVIS_EVENT_TYPE}" == "pull_request" ]] +then + echo "Not deploying on pull request build." + exit 0; +fi + +if [[ "${TRAVIS_TAG:-}" =~ ^v[0-9]\.[0-9]\.[0-9]$ ]] +then + ls -1 wheelhouse + $PIP install twine + $PYTHON -m twine upload --verbose --skip-existing wheelhouse/* +else + echo "Not deploying, git tag doesn't match" +fi -- cgit v1.2.3 From c889e97b4868f0c6f4497a9490f15dfa8351b318 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Fri, 6 Mar 2020 17:07:11 +0000 Subject: Update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4737505..3a6755f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.pyc gensvm/cython_wrapper/*.so +gensvm/cython_wrapper/*.c README build/* cover/* -- cgit v1.2.3