Skip to content

Commit

Permalink
Added AppVeyor and Travis support for building of wheels.
Browse files Browse the repository at this point in the history
  • Loading branch information
gedaskir committed Jul 18, 2017
1 parent ba9e5e0 commit 4316da2
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 4 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
# Python byte files *.pyc
*.pyc

# Text files *.txt
*.txt

# Specific files
docs/index.html.lnk
docs/run.bat
Expand All @@ -37,5 +34,6 @@ qmeq/build
qmeq/tests/__pycache__

# Specific directories
instructions/
project/
qmeq/tests_
43 changes: 43 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
notifications:
email: false

branches:
only:
#- master
- 1.0

matrix:
include:
- os: osx
sudo: required
language: generic
- os: linux
sudo: required
language: generic
services: docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64
- os: linux
sudo: required
language: generic
services: docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_i686
PRE_CMD=linux32

install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then docker pull $DOCKER_IMAGE; fi

script:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then docker run --rm -v $PWD:/io $DOCKER_IMAGE $PRE_CMD /io/scripts/build-wheels-linux.sh; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then scripts/build-wheels-macos.sh; fi
- ls dist/

deploy:
provider: releases
api_key:
secure: qtLJf1SzA5nLwd0HOUUttcNecWo+YcECZduC4gYjto4Gp/IXFE9zvCakJeohveYSKJngwMjOPP3GuWdOU7v5o5wjaOVsb3dfgrjOBdb9Ftu5csd96mp0T1/fcPvt2QdldurAyiVSssT4zApbPqXLU5vESym2F0nCCsdeI4FARd2/VbvB/bqnRTPyblpNXMcs0wMC3SLBj3iVhAGnwHH1mlty6vfmgWViLhT8PHty3LHCGgTS023BskQlgx/BwUQdG2oCO2254T9WPxDoBaodfpwgK/yr2HZzwHaDAmgbccx8DgPHy3Bn1M2Cg6XmxR+rW/griPSZ1APzJcPxCNuJ0GNfxrswhV68b1Lbcds9de6SMuQgJ5TLDBmufCIoVZ4QDwXHdr0xrQe183GxJ9QhsuGwEJ0180D4OW+n88iISnUSZa6eE5zhzfSpxv38jZNdzujfYmNuqgXlszRzLJnZ7SjVvpU8LXUfm4rRHclKUa8HD7WWlf5BsZMSh8nYdCG7ahFwzQLc14X37da+WyQUKZ3abaxKoy10LRrrL/FwQJGPBxnsDmbklwMDgNHQL/1ViRdsisymxV9SbSFRrqz4VAzMw+mbCNnLbz8PHvSJ2QTGmPvhfWg2tUAGnlq1mb8KfMQIVizf4Wid16l6PFQkQD9M2FIcuNaBzGdp39PN8lg=
file_glob: true
file: dist/*.whl
skip_cleanup: true
on:
tags: true
overwrite: true
53 changes: 53 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# A little bit modified file from:
# https://packaging.python.org/guides/supporting-windows-using-appveyor/

notifications:
email: false

branches:
only:
#- master
- 1.0

environment:
matrix:
- PYTHON: "C:\\Python27"
- PYTHON: "C:\\Python34"
- PYTHON: "C:\\Python35"
- PYTHON: "C:\\Python36"
- PYTHON: "C:\\Python27-x64"
- PYTHON: "C:\\Python34-x64"
DISTUTILS_USE_SDK: "1"
- PYTHON: "C:\\Python35-x64"
- PYTHON: "C:\\Python36-x64"

install:
# We need wheel installed to build wheels
- "%PYTHON%\\python.exe -m pip install wheel"
# We need numpy and cython installed to build qmeq
- "%PYTHON%\\python.exe -m pip install cython==0.25.2"
- "%PYTHON%\\python.exe -m pip install numpy==1.13.1"
- "scripts\\build.cmd %PYTHON%\\python.exe setup.py bdist_wheel"

build: off

artifacts:
# bdist_wheel puts your built wheel in the dist directory
- path: dist\*
name: mywheels

deploy:
release: 1.0
description: 'QmeQ 1.0'
provider: GitHub
auth_token:
secure: qH8xSyfc5b1pBf1bWprxtfcaI1wfD3d6PRznR5LDb7ZQN8nnZeCgjx9fopFSL+zf
artifact: mywheels
draft: false
prerelease: false
force_update: true
on:
# release from tag 1.0 only
branch: 1.0
# deploy on tag push only
appveyor_repo_tag: true
2 changes: 1 addition & 1 deletion qmeq/tests/test_various.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_construct_Ea_extended():
system = qmeq.Builder(p.nsingle, p.hsingle, p.coulomb, p.nleads, p.tleads, p.mulst, p.tlst, p.dlst,
indexing=indexing)
system.solve(masterq=False)
assert norm(construct_Ea_extended(system)- data[indexing]) < EPS
assert norm(construct_Ea_extended(system)- data[indexing]) < EPS*10

def test_remove_states():
p = Parameters_double_dot_spinful()
Expand Down
29 changes: 29 additions & 0 deletions scripts/build-wheels-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -e -x

# Different Python versions separated by space
VERS=("cp27-cp27mu" "cp27-cp27m" "cp34-cp34m" "cp35-cp35m" "cp36-cp36m")

# Compile wheels and put them into /io/mywheels/
cd /io
for PYBIN in ${VERS[@]}; do
echo $PYBIN
PYBIN="/opt/python/${PYBIN}/bin"
"${PYBIN}/pip" install -r /io/scripts/requirements.txt
"${PYBIN}/python" setup.py bdist_wheel -d mywheels
"${PYBIN}/python" clean.py
done
cd ..

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

# Install packages and test
for PYBIN in ${VERS[@]}; do
PYBIN="/opt/python/${PYBIN}/bin"
"${PYBIN}/pip" install qmeq --no-index -f /io/dist/
"${PYBIN}/pytest" --pyargs qmeq
done
42 changes: 42 additions & 0 deletions scripts/build-wheels-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
set -e -x

# Different Python versions separated by space
VERS=("2.7" "3.4" "3.5" "3.6")
len=${#VERS[@]}

# Links to different Python versions for MacOS
URLS=("https://www.python.org/ftp/python/2.7.13/python-2.7.13-macosx10.6.pkg"
"https://www.python.org/ftp/python/3.4.4/python-3.4.4-macosx10.6.pkg"
"https://www.python.org/ftp/python/3.5.3/python-3.5.3-macosx10.6.pkg"
"https://www.python.org/ftp/python/3.6.1/python-3.6.1-macosx10.6.pkg")

PYPATH="/Library/Frameworks/Python.framework/Versions/"

for (( i=0; i<${len}; i++ )); do
echo ${VERS[$i]}
echo ${URLS[$i]}
PNAME="/tmp/Python-${VERS[$i]}.pkg"
curl -L -o $PNAME ${URLS[$i]}
sudo installer -pkg $PNAME -target /
#
PYBIN="${PYPATH}/${VERS[$i]}/bin"
sudo ln -sf "${PYBIN}/python${VERS[$i]}" "${PYBIN}/python"
sudo ln -sf "${PYBIN}/pip${VERS[$i]}" "${PYBIN}/pip"
done

# Compile wheels and put them into mywheels/
for PYBIN in ${VERS[@]}; do
PYBIN="${PYPATH}/${PYBIN}/bin"
"${PYBIN}/pip" install -r scripts/requirements.txt
"${PYBIN}/python" setup.py bdist_wheel -d mywheels
"${PYBIN}/python" clean.py
done

# Install packages and test
mv mywheels dist
for PYBIN in ${VERS[@]}; do
PYBIN="${PYPATH}/${PYBIN}/bin"
"${PYBIN}/pip" install qmeq --no-index -f dist
"${PYBIN}/pytest" --pyargs qmeq
done
21 changes: 21 additions & 0 deletions scripts/build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@echo off
:: To build extensions for 64 bit Python 3, we need to configure environment
:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 4
::
:: More details at:
:: https://github.com/cython/cython/wiki/CythonExtensionsOnWindows

IF "%DISTUTILS_USE_SDK%"=="1" (
ECHO Configuring environment to build with MSVC on a 64bit architecture
ECHO Using Windows SDK 7.1
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Setup\WindowsSdkVer.exe" -q -version:v7.1
CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /release
SET MSSdk=1
REM Need the following to allow tox to see the SDK compiler
SET TOX_TESTENV_PASSENV=DISTUTILS_USE_SDK MSSdk INCLUDE LIB
) ELSE (
ECHO Using default MSVC build environment
)

CALL %*
5 changes: 5 additions & 0 deletions scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
wheel
cython==0.25.2
numpy==1.13.1
scipy==0.19.1
pytest==3.1.3

0 comments on commit 4316da2

Please sign in to comment.