.travis.yml 3.09 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
language: cpp

sudo: required
dist: trusty

matrix:
    include:
        - os: linux
          compiler: gcc
        - os: osx
          osx_image: xcode10.1
          compiler: clang

before_install:
  - |
    if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
      sudo add-apt-repository ppa:beineri/opt-qt592-trusty -y &&
      sudo apt-get update -qq
    fi

install:
  - |
    if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
      sudo apt-get -y install qt59base libfuse-dev libmagic-dev &&
      source /opt/qt*/bin/qt*-env.sh
    elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then
      brew tap homebrew/cask && brew install qt5 homebrew/cask/osxfuse
    fi

script:
  - |
    if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
      cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr &&
      make -j$(nproc) &&
      make DESTDIR=appdir -j$(nproc) install ; find appdir/ &&
      sed -i -e 's|^Name=.*|Name=Android File Transfer|g' appdir/usr/share/applications/android-file-transfer.desktop &&
      wget -c -q "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" &&
      chmod a+x linuxdeployqt-continuous-x86_64.AppImage &&
      unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH &&
      export VERSION=$(git rev-parse --short HEAD) &&
      ./linuxdeployqt-continuous-x86_64.AppImage appdir/usr/share/applications/*.desktop -bundle-non-qt-libs &&
      ./linuxdeployqt-continuous-x86_64.AppImage appdir/usr/share/applications/*.desktop -appimage
    elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then
      mkdir build &&
      cd build &&
      cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5 -DCMAKE_INSTALL_PREFIX=$(pwd)/installdir &&
      make -j$(sysctl -n hw.ncpu) &&
      make install &&
      mv installdir/android-file-transfer.app installdir/Android\ File\ Transfer\ for\ Linux.app &&
      mkdir -p installdir/Android\ File\ Transfer\ for\ Linux.app/Contents/SharedSupport/ &&
      mv installdir/bin installdir/Android\ File\ Transfer\ for\ Linux.app/Contents/SharedSupport/ &&
      git clone https://github.com/andreyvit/create-dmg.git &&
      cd create-dmg &&
      ./create-dmg --volicon "../../osx/android-file-transfer.icns" --icon-size 96 --icon "Android File Transfer for Linux" 110 100 --app-drop-link 380 100 AndroidFileTransferForLinux.dmg ../installdir/Android\ File\ Transfer\ for\ Linux.app
    fi

after_success:
  - |
    if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
      find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq &&
      wget https://github.com/d1vanov/ciuploadtool/releases/download/continuous-master/ciuploadtool_linux.zip &&
      unzip ciuploadtool_linux.zip &&
      chmod 755 ciuploadtool &&
      ./ciuploadtool ./Android*.AppImage*
    elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then
      wget https://github.com/d1vanov/ciuploadtool/releases/download/continuous-master/ciuploadtool_mac.zip &&
      unzip ciuploadtool_mac.zip &&
      chmod 755 ciuploadtool &&
      ./ciuploadtool AndroidFileTransferForLinux.dmg
    fi

branches:
  only:
    - master
    - /^v\d+\.\d+$/