From 4d55759f8aa0c467f490ea2bc7c3b3e71c7798d6 Mon Sep 17 00:00:00 2001 From: Jingpeng Wu Date: Fri, 16 Aug 2019 23:54:44 -0400 Subject: [PATCH] build manylinux wheel in travis (#4) * include requirements.txt files; add manifest.in file * add travis build of manylinux wheels * make matrix * put multiple environment variables in one line * add build-wheels.sh * give sudo for build wheel * make the travis build wheel script executable * remove sudo * the docker in pypa is centos rather than ubuntu * add sudo * fix install libboost * use python3.7-dev * fix boost * travis build will upload manylinux wheel * add back docker env * add env * change order * move twine username and password to travis setting * this should work * rename package name * add python3.5 and remove python 3.8 --- .travis.yml | 33 ++++++++++++++++++++++++++++----- setup.py | 4 ++-- travis/build-wheels.sh | 22 ++++++++++++++++++++++ 3 files changed, 52 insertions(+), 7 deletions(-) create mode 100755 travis/build-wheels.sh diff --git a/.travis.yml b/.travis.yml index 3ee3805..56503fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,48 @@ -language: python +language: python + python: - '3.5' - '3.6' - '3.7-dev' +services: +- docker + +env: +- DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64 PLAT=manylinux1_x86_64 +- DOCKER_IMAGE=quay.io/pypa/manylinux1_i686 PRE_CMD=linux32 PLAT=manylinux1_i686 +- DOCKER_IMAGE=quay.io/pypa/manylinux2010_x86_64 PLAT=manylinux2010_x86_64 + +before_install: +- docker pull $DOCKER_IMAGE + install: - sudo find /usr -name '*.pyc' -delete - sudo apt update - sudo apt install libboost-dev - pip install -r requirements.txt -- python setup.py install +- python setup.py install - pip install pytest - pip install coveralls -- pip install pytest-cov # to get .coverage report via pytest +- pip install pytest-cov script: - pytest --cov-append --cov=./waterz ./tests --verbose after_success: -- coveralls +- coveralls +- chmod +x ./travis/build-wheels.sh +- docker run --rm -e PLAT=$PLAT -v `pwd`:/io $DOCKER_IMAGE $PRE_CMD /io/travis/build-wheels.sh +- ls wheelhouse/ +- | + if [[ $TRAVIS_TAG ]]; then + python -m pip install twine + python -m twine upload wheelhouse/waterz*.whl + fi matrix: allow_failures: - - python: '3.7-dev' + - python: 3.8-dev + +notifications: + email: false diff --git a/setup.py b/setup.py index 98fa87b..ac1dfab 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ #from Cython.Build import cythonize import os -version = '0.8.6' +version = '0.9.0' PACKAGE_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -45,7 +45,7 @@ def finalize_options(self): ] setup( - name='waterzed', + name='waterz', version=version, description='Simple watershed and agglomeration for affinity graphs.', long_description=long_description, diff --git a/travis/build-wheels.sh b/travis/build-wheels.sh new file mode 100755 index 0000000..cf34ba5 --- /dev/null +++ b/travis/build-wheels.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e -x + +# Install a system package required by our library +#yum check-update +yum install -y boost-devel + +# Compile wheels +for PYBIN in /opt/python/*/bin; do + "${PYBIN}/pip" install -r /io/requirements.txt + "${PYBIN}/pip" wheel /io/ -w wheelhouse/ +done + +# Bundle external shared libraries into the wheels +for whl in wheelhouse/*.whl; do + auditwheel repair "$whl" --plat $PLAT -w /io/wheelhouse/ +done + +# Install packages and test +for PYBIN in /opt/python/*/bin/; do + "${PYBIN}/pip" install waterz --no-index -f /io/wheelhouse +done