.travis.yml 10.6 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: linux
          dist: trusty
          env: SPEC=linux-g++-64 CONFIG=debug
          sudo: required
26 27 28 29
        - os: android
          language: android
          env: SPEC=android-g++ CONFIG=installer
          sudo: false
30
        - os: osx
dogmaphobic's avatar
dogmaphobic committed
31
          osx_image: xcode8
32
          env: SPEC=macx-clang CONFIG=installer
Don Gagne's avatar
Don Gagne committed
33
          sudo: required
34 35 36 37 38 39 40 41 42
# OSX builds pared back to installer only since travis sucks so bad we can't afford more than one'
#        - os: osx
#          osx_image: xcode8
#          env: SPEC=macx-clang CONFIG=debug
#          sudo: required
#        - os: osx
#          osx_image: xcode8
#          env: SPEC=macx-ios-clang CONFIG=release
#          sudo: false
Daniel Agar's avatar
Daniel Agar committed
43 44 45 46

android:
  components:
    - android-21
47 48
    - build-tools-21.1.1
    - platform-tools
Daniel Agar's avatar
Daniel Agar committed
49

50 51 52 53 54 55
addons:
  apt:
    packages:
    - ccache
    - espeak
    - libespeak-dev
56 57 58
    - libgstreamer-plugins-base1.0-dev
    - libgstreamer1.0-0:amd64
    - libgstreamer1.0-dev
59
    - libsdl2-dev
60
    - libudev-dev
61
    - wget
62

Daniel Agar's avatar
Daniel Agar committed
63
cache:
Daniel Agar's avatar
Daniel Agar committed
64
  directories:
65
    - $HOME/.ccache
Daniel Agar's avatar
Daniel Agar committed
66 67

before_install:
68
  # fetch entire git repo to properly determine the version
69
  - if [ "${CONFIG}" = "installer" ]; then
70
        cd ${TRAVIS_BUILD_DIR} && git fetch --unshallow && git fetch --all --tags;
71
    fi
72 73

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

  # setup ccache
80
  #- ccache -M 500MB && ccache -z
81 82 83 84 85 86

  # 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));
87
    fi
Daniel Agar's avatar
Daniel Agar committed
88 89

install:
90 91
  # linux dependencies: qt
  - if [ "${SPEC}" = "linux-g++-64" ]; then
92 93 94
        wget https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.7.1-linux-min.tar.bz2 &&
        tar jxf Qt5.7.1-linux-min.tar.bz2 -C /tmp &&
        export PATH=/tmp/Qt5.7-linux/5.7/gcc_64/bin:$PATH &&
95
        export DISPLAY=:99.0 &&
Daniel Agar's avatar
Daniel Agar committed
96
        sh -e /etc/init.d/xvfb start
97 98
        ;
    fi
99 100 101

  # android dependencies: qt, gstreamer, android-ndk
  - if [ "${SPEC}" = "android-g++" ]; then
DonLakeFlyer's avatar
DonLakeFlyer committed
102 103
        wget https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.7.1-android-min.tar.bz2 &&
        tar jxf Qt5.7.1-android-min.tar.bz2 -C /tmp &&
104 105 106 107 108 109 110 111
        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 &&
DonLakeFlyer's avatar
DonLakeFlyer committed
112
        export PATH=/tmp/Qt5.7-android/5.7/android_armv7/bin:`pwd`/android-ndk-r10e:$PATH && echo $PATH
113 114 115 116 117
        ;
    fi

  # osx dependencies: qt, gstreamer, gstreamer-devel
  - if [ "${SPEC}" = "macx-clang" ]; then
Don Gagne's avatar
Don Gagne committed
118 119
        wget https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.8.0-mac-clang-min.tar.bz2 &&
        tar jxf Qt5.8.0-mac-clang-min.tar.bz2 -C /tmp &&
120 121 122 123
        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
124
        wget https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/osx-gstreamer.tar.bz2 &&
Don Gagne's avatar
Don Gagne committed
125
        sudo tar jxf osx-gstreamer.tar.bz2 -C /Library/Frameworks &&
Don Gagne's avatar
Don Gagne committed
126
        export QT_DIR=Qt5.8-mac-clang/5.8/clang_64 &&
127
        export QT_QPA_PLATFORM_PLUGIN_PATH=/tmp/$QT_DIR/plugins &&
128
        export QML2_IMPORT_PATH=/tmp/$QT_DIR/qml &&
Don Gagne's avatar
Don Gagne committed
129
        export PATH=/tmp/$QT_DIR/bin:$PATH
130 131
        ;
    fi
132 133 134

  # ios dependencies: qt, TODO: add gstreamer
  - if [ "${SPEC}" = "macx-ios-clang" ]; then
Don Gagne's avatar
Don Gagne committed
135 136
        wget https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.8.0-ios-min.tar.bz2 &&
        tar jxf Qt5.8.0-ios-min.tar.bz2 -C /tmp &&
137
        export IOS_CCACHE_CC=`/usr/bin/xcrun -sdk iphoneos -find clang` &&
138
        export IOS_CCACHE_CXX=`/usr/bin/xcrun -sdk iphoneos -find clang++` &&
Don Gagne's avatar
Don Gagne committed
139
        export PATH=/tmp/Qt5.8-ios/5.8/ios/bin:$PATH &&
dogmaphobic's avatar
dogmaphobic committed
140
        tools/patch_qt_for_xcode8.sh
141
        ;
Daniel Agar's avatar
Daniel Agar committed
142 143
    fi

144
before_script:
Daniel Agar's avatar
Daniel Agar committed
145 146
  - cd ${TRAVIS_BUILD_DIR}

147
  # grab latest PX4 parameter and airframe metadata
148 149
  - 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
150 151

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

156
  # insert QGC version in AndroidManifest.xml
157
  - if [ "${SPEC}" = "android-g++" ]; then
158 159 160
        git remote set-branches origin 'master' &&
        git fetch origin master &&
        ./tools/update_android_version.sh;
161
    fi
162 163 164 165 166 167 168 169 170 171 172

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]});
173
    fi
174
  #- ccache -s
175 176

  # unit tests linux/osx
177 178 179 180 181 182 183 184
  - if [ "${TRAVIS_BRANCH}" != "master" ]; then
        if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "debug" ]]; then
            mkdir -p ~/.config/QtProject/ && cp ${TRAVIS_BUILD_DIR}/test/qtlogging.ini ~/.config/QtProject/ &&
            ./debug/QGroundControl --unittest;
        elif [[ "${SPEC}" = "macx-clang" && "${CONFIG}" = "debug" ]]; then
            mkdir -p ~/Library/Preferences/QtProject/ && cp ${TRAVIS_BUILD_DIR}/test/qtlogging.ini ~/Library/Preferences/QtProject/ &&
            ./debug/qgroundcontrol.app/Contents/MacOS/QGroundControl --unittest;
        fi
185
    fi
Daniel Agar's avatar
Daniel Agar committed
186

187
after_success:
Daniel Agar's avatar
Daniel Agar committed
188 189
  - cd ${TRAVIS_BUILD_DIR}

190 191
  # android google play deploy
  - export GOOGLE_PLAY_TRACK=none;
192 193 194

  # master development builds to beta track
  # tagged releases first to beta track then manually move to production
195
  - if [ "${TRAVIS_TAG}" ]; then
196
        GOOGLE_PLAY_TRACK=beta;
197
    elif [ "${TRAVIS_BRANCH}" = "master" ]; then
198
        GOOGLE_PLAY_TRACK=beta;
199
    fi
200
  - if [[ "${SPEC}" = "android-g++" && "${TRAVIS_PULL_REQUEST}" = "false" && "${GOOGLE_PLAY_TRACK}" != "none" ]]; then
201
        pip install --user google-api-python-client PyOpenSSL &&
Daniel Agar's avatar
Daniel Agar committed
202 203
        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 &&
204
        ./tools/google_play_upload.py ${GOOGLE_PLAY_TRACK} org.mavlink.qgroundcontrol ${SHADOW_BUILD_DIR}/release/package/QGroundControl.apk;
205
    fi
206

207 208
before_deploy:
  # create linux appimage
Daniel Agar's avatar
Daniel Agar committed
209
  - cd ${TRAVIS_BUILD_DIR}
210
  - if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "installer" ]]; then
211
        ./deploy/create_linux_appimage.sh ${TRAVIS_BUILD_DIR} ${SHADOW_BUILD_DIR}/release ${SHADOW_BUILD_DIR}/release/package;
212 213
    fi

Daniel Agar's avatar
Daniel Agar committed
214
deploy:
215
  # deploy installers to s3 builds/ if on a branch
Daniel Agar's avatar
Daniel Agar committed
216 217 218 219 220
  - provider: s3
    access_key_id: AKIAIVORNALE7NHD3T6Q
    secret_access_key:
      secure: BsLXeXUPsCJdX4tawrDnO8OFK5Hk4kzlDTiyH93En6TbjUargVAWDMcHVj7TUhr7+3Tao1W1zb0G4SJe9kHv+jrky0yE72KvoG3YAON0VXWKizxBAKkgHE2RxSTNAwDeKbi2G6YJfNDescBBfX7zEohShdXglQu7CGaUQKRaiI4=
    bucket: qgroundcontrol
dogmaphobic's avatar
dogmaphobic committed
221
    local_dir: ${SHADOW_BUILD_DIR}/release/package
222
    upload-dir: builds/${TRAVIS_BRANCH}
Daniel Agar's avatar
Daniel Agar committed
223
    acl: public_read
224
    region: us-west-2
Daniel Agar's avatar
Daniel Agar committed
225 226 227 228
    skip_cleanup: true
    on:
      all_branches: true
      condition: $CONFIG = installer
229

230
  # deploy tagged installers to s3 latest/
231 232 233 234 235 236 237 238 239 240 241 242 243 244
  - provider: s3
    access_key_id: AKIAIVORNALE7NHD3T6Q
    secret_access_key:
      secure: BsLXeXUPsCJdX4tawrDnO8OFK5Hk4kzlDTiyH93En6TbjUargVAWDMcHVj7TUhr7+3Tao1W1zb0G4SJe9kHv+jrky0yE72KvoG3YAON0VXWKizxBAKkgHE2RxSTNAwDeKbi2G6YJfNDescBBfX7zEohShdXglQu7CGaUQKRaiI4=
    bucket: qgroundcontrol
    local_dir: ${SHADOW_BUILD_DIR}/release/package
    upload-dir: latest
    acl: public_read
    region: us-west-2
    skip_cleanup: true
    on:
      tags: true
      condition: $CONFIG = installer

245 246 247 248 249 250 251
  # deploy tagged installers to s3 version folder
  - provider: s3
    access_key_id: AKIAIVORNALE7NHD3T6Q
    secret_access_key:
      secure: BsLXeXUPsCJdX4tawrDnO8OFK5Hk4kzlDTiyH93En6TbjUargVAWDMcHVj7TUhr7+3Tao1W1zb0G4SJe9kHv+jrky0yE72KvoG3YAON0VXWKizxBAKkgHE2RxSTNAwDeKbi2G6YJfNDescBBfX7zEohShdXglQu7CGaUQKRaiI4=
    bucket: qgroundcontrol
    local_dir: ${SHADOW_BUILD_DIR}/release/package
252
    upload-dir: ${TRAVIS_BRANCH}
253 254 255 256 257 258 259
    acl: public_read
    region: us-west-2
    skip_cleanup: true
    on:
      tags: true
      condition: $CONFIG = installer

260
  # deploy installers to Github releases if on a tag
Daniel Agar's avatar
Daniel Agar committed
261 262 263
  - provider: releases
    api-key:
      secure: K/Zqr/FCC7QvzFxYvBtCinPkacQq2ubJ2qm982+38Zf/KjibVOF1dEbVdrGZmII6Tg5DaQzNXGYkg5PvYmJgT9xRsqeQjeYIUYqYZpAt+HYWA38AVfMU8jip/1P1wmwqD469nzJOBBa8yfsMs6Ca7tBaNl/zTxCRGnAgEzqtkdQ=
264
    file_glob: true
Daniel Agar's avatar
Daniel Agar committed
265
    file:
266
      - ${SHADOW_BUILD_DIR}/release/package/qgroundcontrol.*
267
      - ${SHADOW_BUILD_DIR}/release/package/QGroundControl.*
Daniel Agar's avatar
Daniel Agar committed
268 269 270 271
    skip_cleanup: true
    on:
      tags: true
      condition: $CONFIG = installer
272 273 274 275 276

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