Skip to content

Commit

Permalink
Merge pull request #53 from jeancochrane/ci-builds
Browse files Browse the repository at this point in the history
CI wheel builds
  • Loading branch information
kmike committed May 3, 2017
2 parents 40b561c + 509c2ef commit e310887
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 10 deletions.
6 changes: 6 additions & 0 deletions .manylinux-cython.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Passes the right version of cython into update_cpp.sh for manylinux builds

shopt -s expand_aliases
alias cython="${BIN}/cython"
source ./update_cpp.sh
50 changes: 50 additions & 0 deletions .manylinux-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash

# Kill the build if anything errors
set -e -x

# Compile wheels
for PYBIN in /opt/python/*/bin; do
if [[ "${PYBIN}" == *"cp27"* ]] || \
[[ "${PYBIN}" == *"cp33"* ]] || \
[[ "${PYBIN}" == *"cp34"* ]] || \
[[ "${PYBIN}" == *"cp35"* ]] || \
[[ "${PYBIN}" == *"cp36"* ]];
then
"${PYBIN}/pip" install -r /io/requirements-doc.txt
"${PYBIN}/pip" install tox
"${PYBIN}/pip" install -U cython
export PATH="${PYBIN}:$PATH"
(cd /io/ && export BIN="${PYBIN}" && bash ./.manylinux-cython.sh && "${PYBIN}/tox" -e manylinux)
"${PYBIN}/pip" install -e /io/
"${PYBIN}/pip" wheel /io/ -w wheelhouse/
fi
done

# Bundle external shared libraries into the wheels
for whl in wheelhouse/*.whl; do
auditwheel repair "$whl" -w /io/wheelhouse/
done

# Install new wheels and test
for PYBIN in /opt/python/*/bin; do
if [[ "${PYBIN}" == *"cp27"* ]] || \
[[ "${PYBIN}" == *"cp33"* ]] || \
[[ "${PYBIN}" == *"cp34"* ]] || \
[[ "${PYBIN}" == *"cp35"* ]] || \
[[ "${PYBIN}" == *"cp36"* ]];
then
"${PYBIN}/pip" uninstall -y python-crfsuite
"${PYBIN}/pip" install python-crfsuite --no-index -f /io/wheelhouse
"${PYBIN}/pip" install pytest
"${PYBIN}/pytest" /io/tests --doctest-modules
fi
done

# If everything works, upload wheels to PyPi
travis=$( cat /io/.travis_tag )
SAMPLE_PYBIN="/opt/python/cp35-cp35m/bin"
if [[ $travis ]]; then
"${SAMPLE_PYBIN}/pip" install twine;
"${SAMPLE_PYBIN}/twine" upload --config-file /io/.pypirc /io/wheelhouse/*.whl;
fi
114 changes: 105 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,110 @@
language: python
python: 3.5
sudo: false
env:
- TOXENV=py27
- TOXENV=py33
- TOXENV=py34
- TOXENV=py35
matrix:
include:
- os: linux
python: 3.6
env: TOXENV=py36
- os: linux
python: 3.5
env: TOXENV=py35
- os: linux
python: 3.4
env: TOXENV=py34
- os: linux
python: 3.3
env: TOXENV=py33
- os: linux
python: 2.7
env: TOXENV=py27
- os: osx
language: generic
env:
- PYTHON='3.6.1'
- TOXENV=py36
- os: osx
language: generic
env:
- PYTHON='3.5.3'
- TOXENV=py35
- os: osx
language: generic
env:
- PYTHON='3.4.6'
- TOXENV=py34
- os: osx
language: generic
env:
- PYTHON='3.3.6'
- TOXENV=py33
- os: osx
language: generic
env:
- PYTHON='2.7.12'
- TOXENV=py27
- sudo: required
services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64
- sudo: required
services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_i686
PRE_CMD=linux32

before_install:
- |
if [[ $PYTHON && "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update;
brew install openssl readline;
brew outdated pyenv || brew upgrade pyenv;
brew install pyenv-virtualenv;
pyenv install $PYTHON;
export PYENV_VERSION=$PYTHON;
export PATH="/Users/travis/.pyenv/shims:${PATH}";
pyenv-virtualenv venv;
source venv/bin/activate;
python --version;
fi;
echo [distutils] > ~/.pypirc;
echo index-servers=pypi >> ~/.pypirc;
echo [pypi] >> ~/.pypirc;
echo repository=https://pypi.python.org/pypi >> ~/.pypirc;
echo username=kmike >> ~/.pypirc;
echo password=$PYPIPASSWORD >> ~/.pypirc;
touch .travis_tag;
if [[ $DOCKER_IMAGE ]]; then
echo $TRAVIS_TAG > .travis_tag;
cat ~/.pypirc > .pypirc;
fi;
install:
- pip install tox
- pip install -U cython
- |
if [[ $DOCKER_IMAGE ]]; then
docker pull $DOCKER_IMAGE &&
docker run --rm -v `pwd`:/io $DOCKER_IMAGE $PRE_CMD /io/.manylinux-install.sh;
exit;
else
pip install --upgrade pip;
pip install -r requirements-doc.txt;
pip install tox;
pip install -U cython;
fi;
script:
- ./update_cpp.sh
- tox

after_success:
- pip install wheel twine
- if [[ $TRAVIS_TAG && "$TRAVIS_OS_NAME" == "osx" ]]; then
python -W ignore setup.py bdist_wheel;
twine upload dist/*;
fi;
- if [[ $TRAVIS_TAG && "$TRAVIS_OS_NAME" == "linux" ]]; then
python -W ignore setup.py sdist;
twine upload dist/*;
fi;

env:
global:
- secure: PYPIPASSWORD=yourpypipassword
9 changes: 8 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
[tox]
envlist = py27,py33,py34,py35
envlist = py27,py33,py34,py35,py36

[testenv]
changedir = {envtmpdir}
deps =
pytest
commands =
py.test {toxinidir}/tests --doctest-modules {posargs}

[testenv:manylinux]
changedir = {envtmpdir}
deps =
pytest
commands =
py.test {toxinidir}/tests --doctest-modules {posargs}

0 comments on commit e310887

Please sign in to comment.