Skip to content
This repository has been archived by the owner on May 16, 2019. It is now read-only.

[WIP] Auto Build Server Binaries #492

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
47 changes: 38 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,44 @@
language: python

sudo: true
os:
- linux
- osx
python:
- "2.7"

services:
- docker
install:
- pip install --upgrade pip
- pip install -r requirements.txt
- pip install -r test_requirements.txt

- pip install --upgrade pip
- pip install -r requirements.txt
- pip install -r test_requirements.txt
script:
- make -s

- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ ! -z "$TRAVIS_TAG" ]; then sudo bash travis-linux.sh; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ ! -z "$TRAVIS_TAG" ]; then sudo bash travis-osx.sh; fi
after_success:
- coveralls
- coveralls
before_deploy:
- export RELEASE_PKG_FILE=$(ls dist/openbazaard*)
deploy:
- provider: releases
api_key: "$GITHUB_TOKEN"
file_glob: true
file:
- dist/openbazaard-linux32
- dist/openbazaard-linux64
- dist/openbazaard-windows32.exe
- dist/openbazaard-windows64.exe
skip_cleanup: true
on:
all_branches: true
condition: $TRAVIS_OS_NAME = linux
tags: true
- provider: releases
api_key: "$GITHUB_TOKEN"
file_glob: true
file:
- dist/openbazaard-osx
skip_cleanup: true
on:
all_branches: true
condition: $TRAVIS_OS_NAME = osx
tags: true
31 changes: 31 additions & 0 deletions .travis/openbazaard.linux32.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# -*- mode: python -*-

block_cipher = None


a = Analysis(['../openbazaard.py'],
pathex=['../'],
binaries=None,
datas=None,
hiddenimports=['pystun', 'zmq', 'cryptography', 'cffi', 'packaging'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
a.datas += [('../ob.cfg', 'ob.cfg', 'DATA'),('./bitcointools/english.txt','virt/bitcointools/english.txt','DATA')]
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='openbazaard-linux32',
debug=False,
strip=False,
upx=True,
console=True )
31 changes: 31 additions & 0 deletions .travis/openbazaard.linux64.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# -*- mode: python -*-

block_cipher = None


a = Analysis(['../openbazaard.py'],
pathex=['../'],
binaries=None,
datas=None,
hiddenimports=['pystun', 'zmq', 'cryptography', 'cffi', 'packaging'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
a.datas += [('../ob.cfg', 'ob.cfg', 'DATA'),('./bitcointools/english.txt','virt64/bitcointools/english.txt','DATA')]
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='openbazaard-linux64',
debug=False,
strip=False,
upx=True,
console=True )
29 changes: 29 additions & 0 deletions .travis/openbazaard.mac.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- mode: python -*-

block_cipher = None


a = Analysis(['./OpenBazaar-Server/openbazaard.py'],
pathex=['./OpenBazaar-Server'],
binaries=None,
datas=None,
hiddenimports=['zmq', 'cryptography', 'cffi', 'packaging'],
hookspath=None,
runtime_hooks=None,
excludes=None,
win_no_prefer_redirects=None,
win_private_assemblies=None,
cipher=block_cipher)
a.datas += [('ob.cfg', 'ob.cfg', 'DATA'),('bitcointools/english.txt','env/lib/python2.7/site-packages/bitcointools/english.txt','DATA')]
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='openbazaard-osx',
debug=True,
strip=None,
upx=True,
console=True)
38 changes: 38 additions & 0 deletions .travis/openbazaard.win.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- mode: python -*-

block_cipher = None


a = Analysis(['..\\openbazaard.py'],
pathex=['..\\'],
binaries=None,
datas=None,
hiddenimports=['cryptography', 'bitcoin','zmq.backend.cython' ,'zmq.backend.cffi'],
hookspath=None,
runtime_hooks=None,
excludes=None,
win_no_prefer_redirects=None,
win_private_assemblies=None,
cipher=block_cipher)
a.binaries += [('ssleay32.dll', 'windows\\32\\ssleay32.dll', 'BINARY'),
('libeay32.dll', 'windows\\32\\libeay32.dll', 'BINARY')]
a.datas += [
('ob.cfg', 'ob.cfg', 'DATA'),
('bitcointools\\english.txt', 'windows\\english.txt', 'DATA'),
('msvcr120.dll', 'windows\\32\\msvcr120.dll', 'DATA'),
('msvcr90.dll', 'c:\\Python27\\msvcr90.dll', 'DATA'),
('msvcp90.dll', 'c:\\Python27\\msvcp90.dll', 'DATA')
]
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='openbazaard-windows32',
icon='windows\\icon.ico',
debug=True,
strip=False,
upx=True,
console=True )
38 changes: 38 additions & 0 deletions .travis/openbazaard.win64.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- mode: python -*-

block_cipher = None


a = Analysis(['..\\openbazaard.py'],
pathex=['..\\'],
binaries=None,
datas=None,
hiddenimports=['cryptography', 'bitcoin','zmq.backend.cython' ,'zmq.backend.cffi'],
hookspath=None,
runtime_hooks=None,
excludes=None,
win_no_prefer_redirects=None,
win_private_assemblies=None,
cipher=block_cipher)
a.binaries += [('ssleay32.dll', 'windows\\64\\ssleay32.dll', 'BINARY'),
('libeay32.dll', 'windows\\64\\libeay32.dll', 'BINARY')]
a.datas += [
('ob.cfg', 'ob.cfg', 'DATA'),
('bitcointools\\english.txt', 'windows\\english.txt', 'DATA'),
#('msvcr120.dll', 'c:\\Python27\\msvcr120.dll', 'DATA'),
('msvcr90.dll', 'c:\\Python27\\msvcr90.dll', 'DATA'),
('msvcp90.dll', 'c:\\Python27\\msvcp90.dll', 'DATA')
]
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='openbazaard-windows64',
icon='windows\\icon.ico',
debug=False,
strip=False,
upx=True,
console=True )
45 changes: 45 additions & 0 deletions build-linux32.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

OS="${1}"

mkdir dist


# case "$TRAVIS_OS_NAME" in
# "linux")
cd OpenBazaar/

echo "Building Linux Binaries...."
sudo apt-get -qq update
sudo apt-get install -qq -y wget

echo "32-bit..."

wget -q https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
tar xzf Python-2.7.10.tgz
sudo apt-get -qq -y install gcc-multilib g++-multilib
CFLAGS=-m32 LDFLAGS=-m32 ./configure --prefix=/opt/Python2.7-32bits
make
make install

echo "Installing APT packages"
sudo apt-get -y -qq install npm python-pip python-virtualenv python-dev libffi-dev

echo "Set up virtualenv"
virtualenv virt
. virt/bin/activate

echo "Install Python dependencies"
virt/bin/pip install -q -r requirements.txt
virt/bin/pip install -q pyinstaller==3.1
virt/bin/pip install -q cryptography
virt/bin/pip install -q setuptools==19.2
virt/bin/pyinstaller -D -F .travis/openbazaard.linux32.spec


# ;;
#
# "osx")
#
# ;;
# esac
9 changes: 9 additions & 0 deletions build-linux64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

virtualenv virt64
source virt64/bin/activate
pip install -r requirements.txt
pip install -q pyinstaller==3.1
pip install -q setuptools==19.2
pip install -q cryptography
pyinstaller -D -F .travis/openbazaard.linux64.spec
79 changes: 79 additions & 0 deletions build-win.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/sh

sudo dpkg --add-architecture i386
sudo apt-get update -qq
sudo apt-get install -qq wine1.6

sudo mkdir -p dist/windows32
cd dist/windows32
#wget -O python.msi "http://www.python.org/ftp/python/2.7.12/python-2.7.12.msi"
#wget -O pywin32.exe "http://downloads.sourceforge.net/project/pywin32/pywin32/Build%20220/pywin32-220.win32-py2.7.exe?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fpywin32%2Ffiles%2Fpywin32%2FBuild%2520220%2F&ts=1473864354&use_mirror=superb-sea2"

THIS_SCRIPT_PATH=`readlink -f $0`
THIS_SCRIPT_DIR=`dirname ${THIS_SCRIPT_PATH}`

WINE_TARBALL=${THIS_SCRIPT_DIR}/wine.tar.gz

export WINEPREFIX=`mktemp -d --suffix=_wine`
export WINEARCH="win32 wine wineboot"

echo "Created wine environment at $WINEPREFIX"

if [ "$1" = "--update" ]; then
echo "Update option given. Starting from existing wine.tar.gz"
tar --directory=${WINEPREFIX} -xzf ${WINE_TARBALL}
fi

WINEPREFIX=${WINEPREFIX}

# Install Python
wget -N http://python.org/ftp/python/2.7.11/python-2.7.11.msi
wine msiexec /i python-2.7.11.msi /qn

# Install MSVC
wget -N https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi
wine msiexec /i VCForPython27.msi /qn
wine cmd /c "c:\\Program Files (x86)\\Common Files\\Microsoft\\Visual C++ for Python\\9.0\\vcvarsall.bat" x86

#wget -N https://download.microsoft.com/download/1/1/1/1116b75a-9ec3-481a-a3c8-1777b5381140/vcredist_x86.exe
#wine vcredist_x86.exe /qn

#wine cmd /c "copy c:\\Windows\\System32\\msvcr120.dll c:\\python27"
wine cmd /c "copy c:\\Windows\\System32\\msvcp90.dll c:\\python27"
wine cmd /c "copy c:\\Windows\\System32\\msvcm90.dll c:\\python27"

# Install pip

wget -N https://bootstrap.pypa.io/get-pip.py
wine c:/Python27/python.exe get-pip.py

wget -N http://downloads.sourceforge.net/project/pywin32/pywin32/Build%20218/pywin32-218.win32-py2.7.exe?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fpywin32%2Ffiles%2Fpywin32%2FBuild%2520218%2F&ts=1475598942&use_mirror=heanet -O pywin32.exe
wine pywin32.exe /s

# Fix TLS Certs issue
wine c:/Python27/python -m pip install pyopenssl ndg-httpsclient pyasn1

# Set up Virtualenv
wine c:/Python27/python -m pip install virtualenv
wine c:/Python27/Scripts/virtualenv env
wine c:/Python27/Scripts/activate.bat

wine c:/Python27/python -m pip install vcversioner
wine c:/Python27/python -m pip install https://openbazaar.org/downloads/miniupnpc-1.9-cp27-none-win32.whl
wine c:/Python27/python -m pip install https://openbazaar.org/downloads/PyNaCl-0.3.0-cp27-none-win32.whl
wine c:/Python27/python -m pip install https://openbazaar.org/downloads/Twisted-16.4.1-cp27-cp27m-win32.whl
#wine c:/Python27/python -m pip install https://openbazaar.org/downloads/Twisted-16.4.1-cp27m-win_amd64.whl
#wine c:/Python27/python -m pip install pefile
wine c:/Python27/python -m pip install -r ../../requirements.txt

wine c:/Python27/python -m pip install pyinstaller==3.1
wine c:/Python27/python -m pip install setuptools==19.2
wine c:/Python27/python -m pip install pystun
wine c:/Python27/python -m pip install https://pypi.python.org/packages/7a/ec/47559abcfd6328c802036e8cf00a73885b5a71b4228e7f2dfb51f3ab2d69/pyzmq-15.3.0+fix-cp27-cp27m-win32.whl#md5=fdaa98a1dd2d201cb86229ad59baac17

wget -N https://github.com/pyinstaller/pyinstaller/releases/download/v3.1/PyInstaller-3.1.zip
unzip -o PyInstaller-3.1.zip
cd ../..
wine C:/Python27/python.exe dist/windows32/PyInstaller-3.1/pyinstaller.py -F -n openbazaard-windows32.exe -i images/icon.ico .travis/openbazaard.win.spec --noconfirm --log-level=DEBUG


Loading