Skip to content

Commit

Permalink
Add support for automated wheel packaging / PyPI deploys
Browse files Browse the repository at this point in the history
  • Loading branch information
msanders committed Sep 10, 2018
1 parent 24c47df commit a183303
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
language: python

matrix:
include:
- name: "Linux 64-bit"
sudo: required
services:
- docker
env:
- CIBW_SKIP=*manylinux1_i686*
- PIP=pip
- PYTHON=python
- name: "Linux 32-bit"
sudo: required
services:
- docker
env:
- CIBW_SKIP=*manylinux1_x86_64*
- PIP=pip
- PYTHON=python
- name: "macOS"
os: osx
language: generic
env:
- PIP=pip2
- PYTHON=python2

env:
global:
- TWINE_USERNAME=michael.sanders

script:
- $PIP install cibuildwheel setuptools_rust
- export CIBW_BEFORE_BUILD="pip install setuptools_rust && source ./scripts/travis"
- export CIBW_SKIP=cp34-*\ $CIBW_SKIP
- export CIBW_ENVIRONMENT='PATH="$HOME/rust/bin:$PATH"'
- cibuildwheel --output-dir wheelhouse
- |
if [[ $TRAVIS_TAG ]]; then
$PIP install twine
$PYTHON -m twine upload wheelhouse/*.whl
fi
37 changes: 37 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
environment:
TWINE_USERNAME: michael.sanders
matrix:
# Stable 64-bit MSVC
- channel: stable
target: x86_64-pc-windows-msvc
CIBW_SKIP: "*win32* cp27-* cp33-* cp34-*"
CIBW_BEFORE_BUILD: pip install setuptools-rust
# Stable 32-bit MSVC
- channel: stable
target: i686-pc-windows-msvc
CIBW_SKIP: "*win_amd64* cp27-* cp33-* cp34-*"
CIBW_BEFORE_BUILD: pip install setuptools-rust


# From https://github.com/starkat99/appveyor-rust/blob/master/appveyor.yml
install:
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init -yv --default-toolchain nightly --default-host %target%
- set PATH=%PATH%;%USERPROFILE%\.cargo\bin
- rustc -vV
- cargo -vV
- pip install cibuildwheel==0.9.4 setuptools_rust

build_script:
- cibuildwheel --output-dir wheelhouse
- >
IF "%APPVEYOR_REPO_TAG%" == "true"
(
python -m pip install twine
&&
python -m twine upload 'wheelhouse/*.whl'
)
artifacts:
- path: "wheelhouse\\*.whl"
name: Wheels
15 changes: 15 additions & 0 deletions scripts/travis
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# From https://github.com/benfred/py-cpp-demangle/blob/13a22fd/ci/install_rust.sh
# https://www.benfrederickson.com/writing-python-extensions-in-rust-using-pyo3/
if [ ! -d ~/rust-installer ]; then
set -x
mkdir ~/rust-installer
curl -sL https://static.rust-lang.org/rustup.sh -o ~/rust-installer/rustup.sh
sh ~/rust-installer/rustup.sh --prefix=~/rust --spec=nightly --disable-sudo -y
set +x
fi

if command -v yum; then
yum install -y gpg libXtst libXtst-devel libXext libXext-devel
fi

0 comments on commit a183303

Please sign in to comment.