.travis.yml 8.96 KB
Newer Older
Peter Barker's avatar
Peter Barker committed
1 2
# if you update this file, please consider updating Vagrantfile too

Daniel Agar's avatar
Daniel Agar committed
3 4
language: cpp

Daniel Agar's avatar
Daniel Agar committed
5 6
env:
  global:
7
    - CCACHE_CPP2=1
Don Gagne's avatar
Don Gagne committed
8
    - CCACHE_DISABLE=1
9 10
    - JOBS=4
    - QT_FATAL_WARNINGS=1
11
    - SHADOW_BUILD_DIR=/tmp/shadow_build_dir
Daniel Agar's avatar
Daniel Agar committed
12
    # ANDROID_STOREPASS
13
    - secure: RGovyUnMw3fp/bHZi058JvANT1rYmNqrsuSYew0cIgirO6YbMHr/rsjwCm1FTYpBl8s1zgr+u2b8ftYnfnCz2YT+Aip4NWrVYpVU0FEmfytGILrnUS0pjlt8m7fU9AKR1ElOSll7yw7e1kftynN39Q321etvwbLZcXon6zz0suE=
Daniel Agar's avatar
Daniel Agar committed
14

15
matrix:
16
    fast_finish: true
17 18
    include:
        - os: linux
Daniel Agar's avatar
Daniel Agar committed
19
          dist: trusty
Daniel Agar's avatar
Daniel Agar committed
20 21
          env: SPEC=linux-g++-64 CONFIG=installer
          sudo: required
22 23 24 25
        - os: android
          language: android
          env: SPEC=android-g++ CONFIG=installer
          sudo: false
26
        - os: osx
27
          osx_image: xcode7.3
Daniel Agar's avatar
Daniel Agar committed
28
          env: SPEC=macx-clang CONFIG=debug
Don Gagne's avatar
Don Gagne committed
29
          sudo: required
30
        - os: osx
31
          osx_image: xcode7.3
32
          env: SPEC=macx-clang CONFIG=installer
Don Gagne's avatar
Don Gagne committed
33
          sudo: required
Don Gagne's avatar
Don Gagne committed
34
        - os: osx
35
          osx_image: xcode7.3
36
          env: SPEC=macx-ios-clang CONFIG=release
Daniel Agar's avatar
Daniel Agar committed
37 38 39 40 41
          sudo: false

android:
  components:
    - android-21
42 43
    - build-tools-21.1.1
    - platform-tools
Daniel Agar's avatar
Daniel Agar committed
44

45 46 47 48 49 50
addons:
  apt:
    packages:
    - ccache
    - espeak
    - libespeak-dev
51 52 53
    - libgstreamer-plugins-base1.0-dev
    - libgstreamer1.0-0:amd64
    - libgstreamer1.0-dev
54 55
    - libsdl1.2-dev
    - libudev-dev
56
    - wget
57

Daniel Agar's avatar
Daniel Agar committed
58
cache:
Daniel Agar's avatar
Daniel Agar committed
59
  directories:
60
    - $HOME/.ccache
Daniel Agar's avatar
Daniel Agar committed
61 62

before_install:
63
  # fetch entire git repo to properly determine the version
64
  - if [ "${CONFIG}" = "installer" ]; then
65
        cd ${TRAVIS_BUILD_DIR} && git fetch --unshallow && git fetch --all --tags;
66
    fi
67 68

  # install ccache for osx/ios
69
  - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
70 71
        wget https://s3.amazonaws.com/px4-travis/toolchain/macos/ccache &&
        chmod +x ccache && sudo mv ccache /usr/local/bin;
72
    fi
73 74

  # setup ccache
Daniel Agar's avatar
Daniel Agar committed
75
  - ccache -M 500MB && ccache -z
76 77 78 79 80 81

  # compile threads
  - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
        export JOBS=$((`cat /proc/cpuinfo | grep -c ^processor`+1));
    elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then
        export JOBS=$((`sysctl -n hw.ncpu`+1));
82
    fi
Daniel Agar's avatar
Daniel Agar committed
83 84

install:
85 86
  # linux dependencies: qt
  - if [ "${SPEC}" = "linux-g++-64" ]; then
87 88
        wget https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.5.1-linux-min.tar.bz2 &&
        tar jxf Qt5.5.1-linux-min.tar.bz2 -C /tmp &&
89 90
        export PATH=/tmp/Qt/5.5/gcc_64/bin:$PATH &&
        export DISPLAY=:99.0 &&
Daniel Agar's avatar
Daniel Agar committed
91
        sh -e /etc/init.d/xvfb start
92 93
        ;
    fi
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112

  # android dependencies: qt, gstreamer, android-ndk
  - if [ "${SPEC}" = "android-g++" ]; then
        wget https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.5.1-linux-min.tar.bz2 &&
        tar jxf Qt5.5.1-linux-min.tar.bz2 -C /tmp &&
        wget https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/gstreamer-1.0-android-armv7-1.5.2.tar.bz2 &&
        mkdir -p ${TRAVIS_BUILD_DIR}/gstreamer-1.0-android-armv7-1.5.2 &&
        tar jxf gstreamer-1.0-android-armv7-1.5.2.tar.bz2 -C ${TRAVIS_BUILD_DIR}/gstreamer-1.0-android-armv7-1.5.2 &&
        wget http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin &&
        chmod +x android-ndk-r10e-linux-x86_64.bin &&
        ./android-ndk-r10e-linux-x86_64.bin > /dev/null &&
        export ANDROID_NDK_ROOT=`pwd`/android-ndk-r10e &&
        export ANDROID_SDK_ROOT=/usr/local/android-sdk &&
        export PATH=/tmp/Qt/5.5/android_armv7/bin:`pwd`/android-ndk-r10e:$PATH
        ;
    fi

  # osx dependencies: qt, gstreamer, gstreamer-devel
  - if [ "${SPEC}" = "macx-clang" ]; then
113 114
        wget https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.5.1-mac-clang-min.tar.bz2 &&
        tar jxf Qt5.5.1-mac-clang-min.tar.bz2 -C /tmp &&
115 116 117 118
        wget https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/gstreamer-1.0-1.5.2-x86_64.pkg &&
        sudo installer -verboseR -pkg gstreamer-1.0-1.5.2-x86_64.pkg -target / &&
        wget https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/gstreamer-1.0-devel-1.5.2-x86_64.pkg &&
        sudo installer -verboseR -pkg gstreamer-1.0-devel-1.5.2-x86_64.pkg -target / &&
Don Gagne's avatar
Don Gagne committed
119
        wget https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/osx-gstreamer.tar.bz2 &&
Don Gagne's avatar
Don Gagne committed
120
        sudo tar jxf osx-gstreamer.tar.bz2 -C /Library/Frameworks &&
121 122
        export QT_DIR=Qt5.5-mac-clang/5.5/clang_64 &&
        export QT_QPA_PLATFORM_PLUGIN_PATH=/tmp/$QT_DIR/plugins &&
123
        export QML2_IMPORT_PATH=/tmp/$QT_DIR/qml &&
Daniel Agar's avatar
Daniel Agar committed
124
        export PATH=/tmp/$QT_DIR/bin:$PATH
125 126
        ;
    fi
127 128 129

  # ios dependencies: qt, TODO: add gstreamer
  - if [ "${SPEC}" = "macx-ios-clang" ]; then
130 131 132
        wget https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.5.1-ios-min.tar.bz2 &&
        tar jxf Qt5.5.1-ios-min.tar.bz2 -C /tmp &&
        export IOS_CCACHE_CC=`/usr/bin/xcrun -sdk iphoneos -find clang` &&
133 134
        export IOS_CCACHE_CXX=`/usr/bin/xcrun -sdk iphoneos -find clang++` &&
        export PATH=/tmp/ios/bin:$PATH
135
        ;
Daniel Agar's avatar
Daniel Agar committed
136 137
    fi

138
before_script:
Daniel Agar's avatar
Daniel Agar committed
139 140
  - cd ${TRAVIS_BUILD_DIR}

141
  # grab latest PX4 parameter and airframe metadata
142 143
  - wget http://px4-travis.s3.amazonaws.com/Firmware/master/parameters.xml -O src/FirmwarePlugin/PX4/PX4ParameterFactMetaData.xml
  - wget http://px4-travis.s3.amazonaws.com/Firmware/master/airframes.xml -O src/AutoPilotPlugins/PX4/AirframeFactMetaData.xml
144 145

  # switch android config from installer to release if the android storepass isn't available
146
  - if [[ "${SPEC}" = "android-g++" && "${CONFIG}" = "installer" && -z ${ANDROID_STOREPASS} ]]; then
147
        export CONFIG=release;
148
    fi
149

150
  # insert QGC version in AndroidManifest.xml
151
  - if [ "${SPEC}" = "android-g++" ]; then
Daniel Agar's avatar
Daniel Agar committed
152
        tools/update_android_version.sh;
153
    fi
154 155 156 157 158 159 160 161 162 163 164

script:
  # run qmake
  - mkdir ${SHADOW_BUILD_DIR} && cd ${SHADOW_BUILD_DIR}
  - qmake -r ${TRAVIS_BUILD_DIR}/qgroundcontrol.pro CONFIG+=${CONFIG} CONFIG+=WarningsAsErrorsOn -spec ${SPEC}

  # compile
  - if [ "${SPEC}" != "macx-ios-clang" ]; then
        make -j$JOBS;
    else
        xcodebuild -IDEBuildOperationMaxNumberOfConcurrentCompileTasks=$JOBS -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty -c && $(exit ${PIPESTATUS[0]});
165
    fi
Daniel Agar's avatar
Daniel Agar committed
166
  - ccache -s
167 168 169

  # unit tests linux/osx
  - if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "debug" ]]; then
Daniel Agar's avatar
Daniel Agar committed
170 171
        mkdir -p ~/.config/QtProject/ && cp ${TRAVIS_BUILD_DIR}/test/qtlogging.ini ~/.config/QtProject/ &&
        debug/qgroundcontrol --unittest;
172
    elif [[ "${SPEC}" = "macx-clang" && "${CONFIG}" = "debug" ]]; then
Daniel Agar's avatar
Daniel Agar committed
173 174
        mkdir -p ~/Library/Preferences/QtProject/ && cp ${TRAVIS_BUILD_DIR}/test/qtlogging.ini ~/Library/Preferences/QtProject/ &&
        debug/qgroundcontrol.app/Contents/MacOS/qgroundcontrol --unittest;
175
    fi
Daniel Agar's avatar
Daniel Agar committed
176

177
after_success:
Daniel Agar's avatar
Daniel Agar committed
178 179
  - cd ${TRAVIS_BUILD_DIR}

180 181
  # android google play deploy
  - export GOOGLE_PLAY_TRACK=none;
182
  - if [ "${TRAVIS_TAG}" ]; then
183
        GOOGLE_PLAY_TRACK=production;
184
    elif [ "${TRAVIS_BRANCH}" = "master" ]; then
185
        GOOGLE_PLAY_TRACK=beta;
186
    fi
187
  - if [[ "${SPEC}" = "android-g++" && "${TRAVIS_PULL_REQUEST}" = "false" && "${GOOGLE_PLAY_TRACK}" != "none" ]]; then
188
        pip install --user google-api-python-client PyOpenSSL &&
Daniel Agar's avatar
Daniel Agar committed
189 190 191
        echo "Google Play Track:" ${GOOGLE_PLAY_TRACK} &&
        openssl aes-256-cbc -K $encrypted_25db6eb7c3fd_key -iv $encrypted_25db6eb7c3fd_iv -in android/Google_Play_Android_Developer-4432a3c4f5d1.json.enc -out android/Google_Play_Android_Developer-4432a3c4f5d1.json -d &&
        tools/google_play_upload.py ${GOOGLE_PLAY_TRACK} org.mavlink.qgroundcontrol ${SHADOW_BUILD_DIR}/release/package/qgroundcontrol.apk
192
        ;
193
    fi
194

195 196
before_deploy:
  # create linux appimage
Daniel Agar's avatar
Daniel Agar committed
197
  - cd ${TRAVIS_BUILD_DIR}
198
  - if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "installer" ]]; then
Daniel Agar's avatar
Daniel Agar committed
199
        deploy/create_linux_appimage.sh ${TRAVIS_BUILD_DIR} ${SHADOW_BUILD_DIR}/release ${SHADOW_BUILD_DIR}/release/package;
200 201
    fi

Daniel Agar's avatar
Daniel Agar committed
202
deploy:
203
  # upload installers to s3 if on a branch
Daniel Agar's avatar
Daniel Agar committed
204 205 206 207 208
  - provider: s3
    access_key_id: AKIAIVORNALE7NHD3T6Q
    secret_access_key:
      secure: BsLXeXUPsCJdX4tawrDnO8OFK5Hk4kzlDTiyH93En6TbjUargVAWDMcHVj7TUhr7+3Tao1W1zb0G4SJe9kHv+jrky0yE72KvoG3YAON0VXWKizxBAKkgHE2RxSTNAwDeKbi2G6YJfNDescBBfX7zEohShdXglQu7CGaUQKRaiI4=
    bucket: qgroundcontrol
dogmaphobic's avatar
dogmaphobic committed
209
    local_dir: ${SHADOW_BUILD_DIR}/release/package
210
    upload-dir: builds/${TRAVIS_BRANCH}
Daniel Agar's avatar
Daniel Agar committed
211
    acl: public_read
212
    region: us-west-2
Daniel Agar's avatar
Daniel Agar committed
213 214 215 216
    skip_cleanup: true
    on:
      all_branches: true
      condition: $CONFIG = installer
217 218

  # deploy installers to Github releases if on a tag
Daniel Agar's avatar
Daniel Agar committed
219 220 221
  - provider: releases
    api-key:
      secure: K/Zqr/FCC7QvzFxYvBtCinPkacQq2ubJ2qm982+38Zf/KjibVOF1dEbVdrGZmII6Tg5DaQzNXGYkg5PvYmJgT9xRsqeQjeYIUYqYZpAt+HYWA38AVfMU8jip/1P1wmwqD469nzJOBBa8yfsMs6Ca7tBaNl/zTxCRGnAgEzqtkdQ=
222
    file_glob: true
Daniel Agar's avatar
Daniel Agar committed
223
    file:
224
      - ${SHADOW_BUILD_DIR}/release/package/qgroundcontrol.*
225
      - ${SHADOW_BUILD_DIR}/release/package/QGroundControl.*
Daniel Agar's avatar
Daniel Agar committed
226 227 228 229
    skip_cleanup: true
    on:
      tags: true
      condition: $CONFIG = installer
230 231 232 233 234

notifications:
  webhooks:
    urls:
      - https://webhooks.gitter.im/e/60b033428ae9dc715662
Daniel Agar's avatar
Daniel Agar committed
235 236 237
    on_success: change
    on_failure: always
    on_start: never