# .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.2" os: - osx - linux services: - docker before_install: - | if [[ "$TRAVIS_OS_NAME" == "linux" ]] then cd vendor/yubikey-manager && docker build -t ykman-xenial -f docker/xenial/Dockerfile . id=$(docker create ykman-xenial) docker cp $id:/yubikey-manager-debian-packages.tar.gz ykman-deb.tar.gz docker build -t yubioath-xenial -f docker/xenial/Dockerfile . 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 - pip install --upgrade pip 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 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 $PY_VERSION pyenv global system $PY_VERSION pip install --upgrade pip # Build and install PyOtherside cd vendor/pyotherside qmake make sudo make install cd ../../ fi # Install linting tools - 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" == "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/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/$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 # Copy .app to deploy dir tar -czf deploy/yubioath-desktop-$TRAVIS_BRANCH.app.tar yubioath-desktop.app fi - | if [[ "$TRAVIS_OS_NAME" == "linux" ]] then id=$(docker create 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