yubioath-flutter/.travis.yml
2018-04-19 09:10:26 +02:00

139 lines
5.8 KiB
YAML

# .travis.yml
# Building, testing and deployment on OS X and Linux
# Reference: https://docs.travis-ci.com/user/customizing-the-build
language: cpp
sudo: required
env:
- PY_VERSION="3.6.5" PYOTHERSIDE_VERSION="1.5.3"
os:
- osx
- linux
# Build on El Capitan
osx_image: xcode7.3
services:
- docker
before_install:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]
then
export MACOSX_DEPLOYMENT_TARGET=10.9
brew update
wget https://github.com/thp/pyotherside/archive/$PYOTHERSIDE_VERSION.tar.gz -P ./lib
cd lib
tar -xzvf $PYOTHERSIDE_VERSION.tar.gz
# Patch PyOtherSide to not be built with debug output
echo "DEFINES += QT_NO_DEBUG_OUTPUT" >> pyotherside-$PYOTHERSIDE_VERSION/src/src.pro
cd ..
fi
install:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]
then
git clone https://github.com/aurelien-rainone/macdeployqtfix.git
brew install qt5 swig
brew link qt5 -f
brew install ykpers libyubikey hidapi libusb
# Build Python 3 with --enable-framework, to be able to distribute it in a .app bundle
brew upgrade pyenv
eval "$(pyenv init -)"
env PYTHON_CONFIGURE_OPTS="--enable-framework CC=clang" pyenv install $PY_VERSION
pyenv global system $PY_VERSION
# Build and install PyOtherside
cd lib/pyotherside-$PYOTHERSIDE_VERSION
qmake
make
sudo make install
cd ../..
fi
# Install linting tools
- sudo pip install --upgrade pip
- sudo pip install pre-commit flake8
before_script:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]
then
pre-commit run --all-files
fi
script:
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]
then
docker build -t yubioath-xenial -f docker/xenial/Dockerfile .
fi
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]
then
qmake
make
fi
after_success:
- mkdir deploy/
# Exctract all user facing strings and create a textfile with them for deployment.
- lupdate yubioath-desktop.pro -ts yubioath-desktop.ts
- cp yubioath-desktop.ts deploy/yubioath-desktop-$TRAVIS_BRANCH-strings.xml
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]
then
macdeployqt yubioath-desktop.app/ -qmldir=qml/
# Copy needed dylibs
find /usr/local/Cellar/json-c/ -name '*.dylib' -exec cp '{}' yubioath-desktop.app/Contents/Frameworks/ ';'
find /usr/local/Cellar/ykpers/ -name '*.dylib' -exec cp '{}' yubioath-desktop.app/Contents/Frameworks/ ';'
find /usr/local/Cellar/libyubikey/ -name '*.dylib' -exec cp '{}' yubioath-desktop.app/Contents/Frameworks/ ';'
find /usr/local/Cellar/hidapi/ -name '*.dylib' -exec cp '{}' yubioath-desktop.app/Contents/Frameworks/ ';'
find /usr/local/Cellar/libusb/ -name '*.dylib' -exec cp '{}' yubioath-desktop.app/Contents/Frameworks/ ';'
find /usr/local/Cellar/openssl/ -name '*.dylib' -exec cp '{}' yubioath-desktop.app/Contents/Frameworks/ ';'
# Copy Python framework
cp -a ~/.pyenv/versions/$PY_VERSION/Python.framework yubioath-desktop.app/Contents/Frameworks/
sudo find yubioath-desktop.app/Contents/Frameworks/Python.framework -name '*.pyc' -delete
sudo find yubioath-desktop.app/Contents/Frameworks/Python.framework -name '__pycache__' -delete
# Move pymodules from app bundle to site-packages, to be accepted by codesign
mv yubioath-desktop.app/Contents/MacOS/pymodules/* yubioath-desktop.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/
rm -rf yubioath-desktop.app/Contents/MacOS/pymodules
# Fix stuff that macdeployqt does incorrectly.
sudo python macdeployqtfix/macdeployqtfix.py yubioath-desktop.app/Contents/MacOS/yubioath-desktop /usr/local
# Fix linking for PyOtherSide
sudo install_name_tool -change /Users/travis/.pyenv/versions/$PY_VERSION/Python.framework/Versions/3.6/Python @executable_path/../Frameworks/Python.framework/Versions/3.6/Python yubioath-desktop.app/Contents/Resources/qml/io/thp/pyotherside/libpyothersideplugin.dylib
# Fix linking for Python _ssl
sudo install_name_tool -change /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib @executable_path/../Frameworks/libcrypto.1.0.0.dylib yubioath-desktop.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_ssl.cpython-36m-darwin.so
sudo install_name_tool -change /usr/local/opt/openssl/lib/libssl.1.0.0.dylib @executable_path/../Frameworks/libssl.1.0.0.dylib yubioath-desktop.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_ssl.cpython-36m-darwin.so
# Fix linking for Python _hashlib
sudo install_name_tool -change /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib @executable_path/../Frameworks/libcrypto.1.0.0.dylib yubioath-desktop.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_hashlib.cpython-36m-darwin.so
sudo install_name_tool -change /usr/local/opt/openssl/lib/libssl.1.0.0.dylib @executable_path/../Frameworks/libssl.1.0.0.dylib yubioath-desktop.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_hashlib.cpython-36m-darwin.so
# Rename app bundle
mv yubioath-desktop.app Yubico\ Authenticator.app
# Copy .app to deploy dir
tar -czf yubioath-desktop-$TRAVIS_BRANCH.app.tar.gz Yubico\ Authenticator.app
mv yubioath-desktop-$TRAVIS_BRANCH.app.tar.gz deploy
fi
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]
then
id=$(docker create yubioath-xenial)
docker cp $id:/yubioath-desktop-debian-packages.tar.gz deploy/yubioath-desktop-$TRAVIS_BRANCH-deb.tar.gz
fi
deploy:
provider: s3
access_key_id: "$AWS_KEY_ID"
secret_access_key: "$AWS_SECRET_KEY"
bucket: "$AWS_BUCKET"
skip_cleanup: true
acl: public-read
region: eu-west-1
local-dir: "deploy/"
upload-dir: "yubioath-desktop"
on:
all_branches: true