Skip to content

Commit

Permalink
Add Travis compilation and PyPI upload
Browse files Browse the repository at this point in the history
* Only deploy on tagged commits

Merges #17
  • Loading branch information
zietzm authored Aug 1, 2019
1 parent fd9da6c commit 8e17a10
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
dist/
.vscode/
__pycache__/
.pytest_cache/
Expand Down
98 changes: 69 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,71 @@
dist: xenial
language: python
python:
- 3.5
- 3.6
- 3.7
install:
- pip install -r tests-require.txt
addons:
apt:
packages:
- pkg-config
- python3-dev
setup_and_test: &setup_and_test
stage: test
language: python
addons:
apt:
packages:
- pkg-config
- python3-dev
before_install:
- pip install -r tests-require.txt
install:
- pkg-config --cflags --libs python3
- python setup.py build
- pip install .
script:
- pytest tests/
- >
g++ tests/test_bitset.cpp xswap/src/xswap.h xswap/src/bitset.cpp
xswap/lib/roaring.c -o tests/test_bitset.o -std=c++11
`pkg-config --cflags --libs python3`
- ./tests/test_bitset.o
- >
g++ tests/test_roaring.cpp xswap/src/xswap.h xswap/src/bitset.cpp
xswap/lib/roaring.c -o tests/test_roaring.o -std=c++11
`pkg-config --cflags --libs python3`
- ./tests/test_roaring.o

build_and_upload: &build_and_upload
stage: deploy
sudo: required
if: tag IS present
services:
- docker
install:
- docker pull $DOCKER_IMAGE
script:
- docker run --rm -e PLAT=$PLAT -v `pwd`:/io $DOCKER_IMAGE /io/ci/build-wheels.sh
- /opt/python/3.6/bin/pip install twine
- /opt/python/3.6/bin/python -m twine upload -u zietzm -p $PYPI_PASSWORD --repository-url https://upload.pypi.org/legacy/ --skip-existing wheelhouse/*

compiler:
- g++
script:
- pkg-config --cflags --libs python3
- python setup.py build
- pip install .
- pytest tests/
- >
g++ tests/test_bitset.cpp xswap/src/xswap.h xswap/src/bitset.cpp
xswap/lib/roaring.c -o tests/test_bitset.o -std=c++11
`pkg-config --cflags --libs python3`
- ./tests/test_bitset.o
- >
g++ tests/test_roaring.cpp xswap/src/xswap.h xswap/src/bitset.cpp
xswap/lib/roaring.c -o tests/test_roaring.o -std=c++11
`pkg-config --cflags --libs python3`
- ./tests/test_roaring.o
- cat tests/permutation_stats.txt
matrix:
include:
- <<: *setup_and_test
name: "Test 3.5 on Ubuntu"
dist: xenial
python: 3.5
- <<: *setup_and_test
name: "Test 3.6 on Ubuntu"
dist: xenial
python: 3.6
- <<: *setup_and_test
name: "Test 3.7 on Ubuntu"
dist: xenial
python: 3.7
- <<: *build_and_upload
name: "Build manylinux1_x86_64"
env:
- DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64
- PLAT=manylinux1_x86_64
- <<: *build_and_upload
name: "Build manylinux1_i686"
env:
- DOCKER_IMAGE=quay.io/pypa/manylinux1_i686
- PLAT=manylinux1_i686
- <<: *build_and_upload
name: "Build manylinux2010_x86_64"
env:
- DOCKER_IMAGE=quay.io/pypa/manylinux2010_x86_64
- PLAT=manylinux2010_x86_64
11 changes: 11 additions & 0 deletions ci/build-wheels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Compile wheels
/opt/python/cp35-cp35m/bin/pip wheel /io/ -w wheelhouse/
/opt/python/cp36-cp36m/bin/pip wheel /io/ -w wheelhouse/
/opt/python/cp37-cp37m/bin/pip wheel /io/ -w wheelhouse/

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

0 comments on commit 8e17a10

Please sign in to comment.