Skip to content

Commit

Permalink
Switch to Azure pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
milesgranger committed May 6, 2019
1 parent c673aad commit 9020d95
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 168 deletions.
60 changes: 0 additions & 60 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include Cargo.toml
recursive-include src *
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

### Python implementation of the [Gap Statistic](http://www.web.stanford.edu/~hastie/Papers/gap.pdf)

Linux & OSX: [![Build Status](https://travis-ci.org/milesgranger/gap_statistic.svg?branch=master)](https://travis-ci.org/milesgranger/gap_statistic)
      Windows: [![Build status](https://ci.appveyor.com/api/projects/status/fbnv8del2qkx56j1?svg=true)](https://ci.appveyor.com/project/milesgranger/gap-statistic)
[![Build Status](https://milesgranger.visualstudio.com/builds/_apis/build/status/gap_stat?branchName=master)](https://milesgranger.visualstudio.com/builds/_build/latest?definitionId=5&branchName=master)

[![Downloads](http://pepy.tech/badge/gap-stat)](http://pepy.tech/project/gap-stat)
[![Coverage Status](https://coveralls.io/repos/github/milesgranger/gap_statistic/badge.svg)](https://coveralls.io/github/milesgranger/gap_statistic)
Expand Down
43 changes: 0 additions & 43 deletions appveyor.yml

This file was deleted.

115 changes: 115 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
trigger:
branches:
include:
- master
- releases/*
- refs/tags/*
- refs/heads/*

jobs:
- job: Windows
pool:
vmImage: 'VS2017-Win2016'
strategy:
maxParallel: 2
matrix:
Python36:
PYTHON_VERSION: '3.6'
PYTHON_ARCH: 'x64'
RUSTUP_TOOLCHAIN: nightly
TEST_MODE: fast
BITS: 64
Python37:
PYTHON_VERSION: '3.7'
RUSTUP_TOOLCHAIN: nightly
PYTHON_ARCH: 'x64'
TEST_MODE: fast
BITS: 64
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(PYTHON_VERSION)'
addToPath: true
architecture: '$(PYTHON_ARCH)'

- script: |
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN%
set PATH=%PATH%;%USERPROFILE%\.cargo\bin
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
displayName: Install rust (windows)
- script: cargo test --verbose
displayName: 'Cargo Test'

- script: |
cargo clean
pip install setuptools-rust setuptools pytest wheel
python setup.py test
displayName: "Python Test"
- script: |
cargo clean
pip install twine
python setup.py build_ext
python -m pip -v wheel . -w .\\dist
dir dist
displayName: "Build wheels"
- task: DownloadSecureFile@1
inputs:
secureFile: .pypirc

- script: 'twine upload --config-file $(Agent.TempDirectory)\.pypirc --skip-existing .\\dist\*'
displayName: "Publish to PyPI"
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'))

- job: Linux
pool:
vmImage: 'Ubuntu 16.04'
strategy:
maxParallel: 2
matrix:
Python36:
PYTHON_VERSION: '3.6'
RUSTUP_TOOLCHAIN: nightly
TEST_MODE: fast
Python37:
PYTHON_VERSION: '3.7'
RUSTUP_TOOLCHAIN: nightly
TEST_MODE: fast
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(PYTHON_VERSION)'
addToPath: true

- script: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $(RUSTUP_TOOLCHAIN)
export PATH=$PATH:$HOME/.cargo/bin
displayName: 'Install rustc'
- script: |
export PATH=$PATH:$HOME/.cargo/bin
cargo test --verbose
displayName: 'Cargo Test'
- script: |
export PATH=$PATH:$HOME/.cargo/bin
cargo clean
pip install setuptools-rust setuptools pytest wheel==0.31.1
python setup.py test
displayName: "Python Test"
- script: |
export PATH=$PATH:$HOME/.cargo/bin
pip install twine
cargo clean
docker run --rm -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 bash /io/build-wheels.sh
displayName: "Build wheels"
- task: DownloadSecureFile@1
inputs:
secureFile: .pypirc

- task: TwineAuthenticate@0
inputs:
artifactFeeds: 'https://pypi.org/'

- script: 'twine upload --config-file $(Agent.TempDirectory)/.pypirc --skip-existing ./dist/*-manylinux*.whl'
displayName: "Publish to PyPI"
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'))

75 changes: 12 additions & 63 deletions build-wheels.sh
Original file line number Diff line number Diff line change
@@ -1,69 +1,18 @@
#!/bin/bash
set -e -x
set -ex

function install_rust {
curl https://static.rust-lang.org/rustup.sh > /tmp/rustup.sh
chmod +x /tmp/rustup.sh
/tmp/rustup.sh -y --disable-sudo --channel=$1
}
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
export PATH="$HOME/.cargo/bin:$PATH"

cd /io

if [[ $TRAVIS_OS_NAME == "osx" ]]; then
for PYBIN in /opt/python/{cp35-cp35m,cp36-cp36m,cp37-cp37m}/bin; do
export PYTHON_SYS_EXECUTABLE="$PYBIN/python"

brew update
curl https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh --output miniconda.sh
bash ./miniconda.sh -bp $HOME/anaconda
export PATH="$HOME/anaconda/bin:$PATH"
echo "Installing python version: ${PYTHON_VERSION}"
conda install -y virtualenv python==$PYTHON_VERSION
virtualenv venv
source ./venv/bin/activate
export PATH=$(pwd)/venv/bin:$PATH
echo "Python version: $(python --version)"
pip install -U pip setuptools setuptools-rust wheel numpy scipy pandas joblib pytest scikit-learn
install_rust nightly
pip wheel . -w ./wheelhouse/
pip install -v gap-stat --no-index -f ./wheelhouse/
pip install -r "requirements.txt"
pytest tests -vs
"${PYBIN}/pip" install -U setuptools wheel==0.31.1 setuptools-rust
"${PYBIN}/python" setup.py bdist_wheel
done

else

# Build wheels with docker run --rm -v $(pwd):/io quay.io/pypa/manylinux1_x86_64 bash /io/build-wheels.sh linux
echo "Installing rust!"
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 -y --disable-sudo
export PATH="$HOME/rust/bin:$PATH"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/rust/lib"

# Compile wheels
for PYBIN in /opt/python/cp{35,36}*/bin; do
export PYTHON_SYS_EXECUTABLE="$PYBIN/python"
export PYTHON_LIB=$(${PYBIN}/python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
export LIBRARY_PATH="$LIBRARY_PATH:$PYTHON_LIB"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PYTHON_LIB"
pushd /io
"${PYBIN}/pip" install -U setuptools setuptools-rust wheel numpy scipy pandas joblib pytest scikit-learn
"${PYBIN}/python" setup.py bdist_wheel --dist-dir /io/wheelhouse/
popd
done

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

# Install packages and test
for PYBIN in /opt/python/cp{35,36}*/bin/; do
pushd /io
"${PYBIN}/pip" uninstall gap-stat
"${PYBIN}/pip" install gap-stat --no-index -f /io/wheelhouse
# Actually requires glibc 2.14 which isn't available on Centos 5...
# The tests are ran on OSX and Windows, so this is ok for now.
#"${PYBIN}/python" -m pytest tests -vs
popd
done

fi
for whl in dist/*.whl; do
auditwheel repair "$whl" -w dist/
done
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build-system]
requires = ["setuptools", "wheel==0.31.1", "setuptools-rust"]
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
python_files = "test_*.py"

0 comments on commit 9020d95

Please sign in to comment.