diff --git a/.travis.yml b/.travis.yml index 4ff7025f..4a4d6ea3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -135,12 +135,11 @@ jobs: condition: $TRAVIS_OS_NAME = "osx" - stage: skyapi before_deploy: + - cd lib/skyapi/ - echo "Generating distribution archives before deploy" - make sdist - make bdist_wheel - - if [ $TRAVIS_OS_NAME == "linux" && $TOXENV == "py37" ]; then make bdist_manylinux_amd64 ; fi - ls dist - - cd lib/skyapi/ deploy: - provider: pypi distributions: sdist bdist_wheel diff --git a/.travis/install-linux.sh b/.travis/install-linux.sh index 90e4ec22..8fe59780 100644 --- a/.travis/install-linux.sh +++ b/.travis/install-linux.sh @@ -16,7 +16,7 @@ curl -sL -o "$HOME/bin/gimme" https://raw.githubusercontent.com/travis-ci/gimme/ chmod +x "$HOME/bin/gimme" # Install Python libraries -$PIP install --upgrade pip setuptools tox-travis +$PIP install --upgrade --user pip setuptools tox-travis $PIP install -r "$REPO_ROOT/requirements.dev.txt" $PIP install -r "$REPO_ROOT/lib/skyapi/requirements.txt" $PIP install -r "$REPO_ROOT/lib/skyapi/test-requirements.txt" diff --git a/lib/skyapi/.travis/build_wheels.sh b/lib/skyapi/.travis/build_wheels.sh new file mode 100644 index 00000000..4b76f02e --- /dev/null +++ b/lib/skyapi/.travis/build_wheels.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e -x + +# Install system packages required by our library +yum install -y sudo pcre pcre-devel +mkdir -p "$HOME/bin" +PIP=/opt/python/cp27-cp27m/bin/pip source /io/.travis/install-linux.sh +eval "$(gimme 1.10)" + +# Compile wheels +for PYBIN in /opt/python/*/bin; do + "${PYBIN}/pip" install -r /io/requirements.dev.txt + "${PYBIN}/pip" wheel /io/ -w wheelhouse/ +done + +# Bundle external shared libraries into the wheels +for whl in wheelhouse/*.whl; do + auditwheel repair "$whl" -w /io/wheelhouse/ +done + diff --git a/lib/skyapi/.travis/check_wheels.sh b/lib/skyapi/.travis/check_wheels.sh new file mode 100644 index 00000000..d34f9847 --- /dev/null +++ b/lib/skyapi/.travis/check_wheels.sh @@ -0,0 +1,12 @@ + +#!/bin/bash +set -e -x + +# Code that follows assumes that wheels have been generated by build_wheels.sh + +# Install packages and test +for PYBIN in /opt/python/*/bin/; do + "${PYBIN}/pip" install pyskycoin --no-index -f /io/wheelhouse + (cd /io ; "${PYBIN}/python" -m pytest --showlocals tests ) +done + diff --git a/lib/skyapi/.travis/install-linux.sh b/lib/skyapi/.travis/install-linux.sh new file mode 100644 index 00000000..8fe59780 --- /dev/null +++ b/lib/skyapi/.travis/install-linux.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +set -ev + +# Environment checks +if [ "$PIP" == "" ]; then + export PIP='python -m pip' +fi + +# Repository root path +REPO_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/.." +echo "Install Linux packages from $REPO_ROOT" + +# Install gimme +curl -sL -o "$HOME/bin/gimme" https://raw.githubusercontent.com/travis-ci/gimme/master/gimme +chmod +x "$HOME/bin/gimme" + +# Install Python libraries +$PIP install --upgrade --user pip setuptools tox-travis +$PIP install -r "$REPO_ROOT/requirements.dev.txt" +$PIP install -r "$REPO_ROOT/lib/skyapi/requirements.txt" +$PIP install -r "$REPO_ROOT/lib/skyapi/test-requirements.txt" + +# Compile SWIG +mkdir swig_build && \ + cd swig_build && \ + curl -sL -o "swig-3.0.12.tar.gz" http://prdownloads.sourceforge.net/swig/swig-3.0.12.tar.gz && \ + tar -zxf swig-3.0.12.tar.gz && \ + cd swig-3.0.12 && \ + sudo ./configure --prefix=/usr && \ + sudo make && \ + sudo make install && \ + cd ../../ && \ + sudo rm -rf swig_build + diff --git a/lib/skyapi/.travis/install-osx.sh b/lib/skyapi/.travis/install-osx.sh new file mode 100644 index 00000000..4fa270a2 --- /dev/null +++ b/lib/skyapi/.travis/install-osx.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -ev + +# Install some dependencies +brew update; +brew outdated pyenv || brew upgrade pyenv; +brew install pyenv-virtualenv +brew install swig; +brew install gimme; + +# Install Python +pyenv install ${PYTHON} +pyenv install 2.7.14 +pyenv global ${PYTHON} 2.7.14 + +# Prepare and initialize pyenv environment +eval "$(pyenv init -)"; +eval "$(pyenv virtualenv-init -)"; +pyenv rehash + +# Setup environment and PATH in MacOS +export PYCMD_VERSION="$(echo ${PYTHON} | cut -d . -f 1,2)" +export PYCMD_PATH="$(pyenv which python${PYCMD_VERSION})" +export PYCMD_DIRPATH="$( dirname ${PYCMD_PATH} )" +export PATH="${PYCMD_DIRPATH}:/Users/travis/.pyenv/shims:${PATH}" + +eval "python${PYCMD_VERSION} -m pip install --upgrade pip setuptools wheel tox tox-pyenv pytest pytest-runner" +