yubioath-flutter/.travis.yml
2017-05-02 15:28:07 +02:00

133 lines
5.2 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
os:
- osx
- linux
services:
- docker
before_install:
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]
then
docker build -t xenial docker/xenial
fi
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]
then
export MACOSX_DEPLOYMENT_TARGET=10.9
brew update
# Patch PyOtherSide to not be built with debug output
echo "DEFINES += QT_NO_DEBUG_OUTPUT" >> vendor/pyotherside/src/src.pro
fi
install:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]
then
git clone https://github.com/iltommi/macdeployqtfix.git
brew update
brew install qt5 swig
brew link qt5 -f
brew install ykpers libyubikey hidapi libu2f-host 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 3.6.1
pyenv global system 3.6.1
# Upgrade pip
pip install --upgrade pip
# Build and install PyOtherside
cd vendor/pyotherside
qmake
make
sudo make install
cd ../../
qmake
fi
# Install linting tools
- pip install pre-commit flake8
before_script:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]
then
pre-commit run --all-files
fi
script:
- |
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-HEAD-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/libu2f-host/ -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/3.6.1/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 -d 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/3.6.1/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
# Create .pkg
pkgbuild --install-location /Applications --component yubioath-desktop.app yubioath-desktop-$TRAVIS_BRANCH-HEAD-mac.pkg
# Copy to deploy dir
cp yubioath-desktop-$TRAVIS_BRANCH-HEAD-mac.pkg deploy/
# Copy .app to deploy dir
tar -czf deploy/yubioath-desktop-$TRAVIS_BRANCH-HEAD.app.tar yubioath-desktop.app
fi
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]
then
id=$(docker create xenial)
docker cp $id:/yubioath-desktop-debian-builds.tar.gz deploy/
mv deploy/yubioath-desktop-debian-builds.tar.gz deploy/yubioath-desktop-debian-builds-$TRAVIS_BRANCH-HEAD.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