.travis.yml 10.5 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
    - JOBS=4
Don Gagne's avatar
Don Gagne committed
8 9
    # QT_FATAL_WARNINGS is turned off because Qt 5.11.3 throws a speech dispatcher not working warning when running unit tests
    #- QT_FATAL_WARNINGS=1
10
    - SHADOW_BUILD_DIR=/tmp/shadow_build_dir
Daniel Agar's avatar
Daniel Agar committed
11
    # ANDROID_STOREPASS
12
    - secure: RGovyUnMw3fp/bHZi058JvANT1rYmNqrsuSYew0cIgirO6YbMHr/rsjwCm1FTYpBl8s1zgr+u2b8ftYnfnCz2YT+Aip4NWrVYpVU0FEmfytGILrnUS0pjlt8m7fU9AKR1ElOSll7yw7e1kftynN39Q321etvwbLZcXon6zz0suE=
Daniel Agar's avatar
Daniel Agar committed
13

14
matrix:
15
    fast_finish: true
16
    include:
Don Gagne's avatar
Don Gagne committed
17 18
        - name: "Linux Installer"
          os: linux
Don Gagne's avatar
Don Gagne committed
19
          dist: xenial
Daniel Agar's avatar
Daniel Agar committed
20 21
          env: SPEC=linux-g++-64 CONFIG=installer
          sudo: required
Don Gagne's avatar
Don Gagne committed
22 23
        - name: "Linux Debug"
          os: linux
Don Gagne's avatar
Don Gagne committed
24
          dist: xenial
25
          env: SPEC=linux-g++-64 CONFIG=debug
Don Gagne's avatar
Don Gagne committed
26
          services: xvfb
27
          sudo: required
Don Gagne's avatar
Don Gagne committed
28 29
        - name: "Android 32 bit"
          dist: trusty
30
          language: android
Don Gagne's avatar
Don Gagne committed
31
          env: SPEC=android-clang CONFIG=installer BITNESS=32
32
          sudo: false
Don Gagne's avatar
Don Gagne committed
33 34
        - name: "Android 64 bit"
          dist: trusty
Don Gagne's avatar
Don Gagne committed
35
          language: android
Don Gagne's avatar
Don Gagne committed
36
          env: SPEC=android-clang CONFIG=installer BITNESS=64
Don Gagne's avatar
Don Gagne committed
37
          sudo: false
Don Gagne's avatar
Don Gagne committed
38 39
        - name: "OSX Installer"
          os: osx
Don Gagne's avatar
Don Gagne committed
40
          osx_image: xcode9.2
Don Gagne's avatar
Don Gagne committed
41 42
          env: SPEC=macx-clang CONFIG=installer
          sudo: required
43 44 45 46 47
# iOS build needs updating Qt to > 5.10
#        - os: osx
#          osx_image: xcode9.2
#          env: SPEC=macx-ios-clang CONFIG=release
#          sudo: false
48 49
# OSX builds pared back to installer only since travis sucks so bad we can't afford more than one'
#        - os: osx
Don Gagne's avatar
Don Gagne committed
50
#          osx_image: xcode10.1
51 52
#          env: SPEC=macx-clang CONFIG=debug
#          sudo: required
Daniel Agar's avatar
Daniel Agar committed
53 54 55

android:
  components:
Don Gagne's avatar
Don Gagne committed
56 57
    - android-25
    - build-tools-25.0.3
58
    - platform-tools
Daniel Agar's avatar
Daniel Agar committed
59

60 61 62
addons:
  apt:
    packages:
Don Gagne's avatar
Don Gagne committed
63
    - speech-dispatcher
64 65 66
    - libgstreamer-plugins-base1.0-dev
    - libgstreamer1.0-0:amd64
    - libgstreamer1.0-dev
67
    - libsdl2-dev
68
    - libudev-dev
69
    - wget
70

Daniel Agar's avatar
Daniel Agar committed
71
before_install:
72
  # fetch entire git repo to properly determine the version
73
  - if [ "${CONFIG}" = "installer" ]; then
74
        cd ${TRAVIS_BUILD_DIR} && git fetch --unshallow && git fetch --all --tags;
75
    fi
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
Don Gagne's avatar
Don Gagne committed
87 88 89
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.11.3-gcc_64-min.tar.bz2 &&
        tar jxf Qt5.11.3-gcc_64-min.tar.bz2 -C /tmp &&
        export PATH=/tmp/Qt5.11-gcc_64/5.11.3/gcc_64/bin:$PATH
90 91
        ;
    fi
92 93

  # android dependencies: qt, gstreamer, android-ndk
94
  - if [ "${SPEC}" = "android-clang" ]; then
95
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/gstreamer-1.0-android-universal-1.14.4.tar.bz2 &&
96
        tar jxf gstreamer-1.0-android-universal-1.14.4.tar.bz2 -C ${TRAVIS_BUILD_DIR} &&
97 98 99
        wget --quiet https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip &&
        unzip android-ndk-r20-linux-x86_64.zip > /dev/null &&
        export ANDROID_NDK_ROOT=`pwd`/android-ndk-r20 &&
100
        export ANDROID_SDK_ROOT=/usr/local/android-sdk &&
Don Gagne's avatar
Don Gagne committed
101 102 103 104
        export PATH=`pwd`/android-ndk-r20:$PATH
        ;
    fi

Don Gagne's avatar
Don Gagne committed
105
  - if [[ "${SPEC}" = "android-clang" && "${BITNESS}" = "64" ]]; then
Don Gagne's avatar
Don Gagne committed
106 107 108 109 110 111
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.12.4-android_arm64_v8a-min.tar.bz2 &&
        tar jxf Qt5.12.4-android_arm64_v8a-min.tar.bz2 -C /tmp &&
        export PATH=/tmp/Qt5.12-android_arm64_v8a/5.12.4/android_arm64_v8a/bin:$PATH
        ;
    fi

Don Gagne's avatar
Don Gagne committed
112
  - if [[ "${SPEC}" = "android-clang" && "${BITNESS}" = "32" ]]; then
Don Gagne's avatar
Don Gagne committed
113 114 115
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.12.4-android_armv7-min.tar.bz2 &&
        tar jxf Qt5.12.4-android_armv7-min.tar.bz2 -C /tmp &&
        export PATH=/tmp/Qt5.12-android_armv7/5.12.4/android_armv7/bin:$PATH
116 117 118
        ;
    fi

119
  # osx dependencies: qt (master builds only: gstreamer, gstreamer-devel)
120
  - if [ "${SPEC}" = "macx-clang" ]; then
121 122
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.11.0-clang_64-min.tar.bz2 &&
        tar jxf Qt5.11.0-clang_64-min.tar.bz2 -C /tmp
123 124 125
        ;
    fi

DonLakeFlyer's avatar
DonLakeFlyer committed
126
  - if [[ "${SPEC}" = "macx-clang" ]]; then
127
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/osx-gstreamer.tar.bz2 &&
128 129 130 131 132
        sudo tar jxf osx-gstreamer.tar.bz2 -C /Library/Frameworks
        ;
    fi

  - if [ "${SPEC}" = "macx-clang" ]; then
133
        export QT_DIR=Qt5.11-clang_64/5.11.0/clang_64 &&
134
        export QT_QPA_PLATFORM_PLUGIN_PATH=/tmp/$QT_DIR/plugins &&
135
        export QML2_IMPORT_PATH=/tmp/$QT_DIR/qml &&
Don Gagne's avatar
Don Gagne committed
136
        export PATH=/tmp/$QT_DIR/bin:$PATH
137 138
        ;
    fi
139

140
  # ios dependencies: qt
141
  - if [ "${SPEC}" = "macx-ios-clang" ]; then
142 143 144 145
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.9.3-ios-min.tar.bz2
        ;
    fi
  - if [ "${SPEC}" = "macx-ios-clang" ]; then
146
        tar jxf Qt5.9.3-ios-min.tar.bz2 -C /tmp &&
147
        export IOS_CCACHE_CC=`/usr/bin/xcrun -sdk iphoneos -find clang` &&
148
        export IOS_CCACHE_CXX=`/usr/bin/xcrun -sdk iphoneos -find clang++` &&
149
        export PATH=/tmp/Qt5.9-ios/5.9.3/ios/bin:$PATH
150
        ;
Daniel Agar's avatar
Daniel Agar committed
151 152
    fi

153
before_script:
Daniel Agar's avatar
Daniel Agar committed
154 155
  - cd ${TRAVIS_BUILD_DIR}

156
  # switch android config from installer to release if the android storepass isn't available
157
  - if [[ "${SPEC}" = "android-clang" && "${CONFIG}" = "installer" && -z ${ANDROID_STOREPASS} ]]; then
158
        export CONFIG=release;
159
    fi
160

161
  # insert QGC version in AndroidManifest.xml
162
  - if [ "${SPEC}" = "android-clang" ]; then
163
        git remote set-branches origin 'master' &&
164
        git fetch --tags origin master &&
165
        ./tools/update_android_version.sh ${BITNESS} ${TRAVIS_BRANCH};
166
    fi
167 168 169 170

script:
  # run qmake
  - mkdir ${SHADOW_BUILD_DIR} && cd ${SHADOW_BUILD_DIR}
171 172
  # Due to possible bug in Qt 5.11 WarningsAsErrorsOn is off for Linux builds. Hopefully back on once that is resolved.
  - if [ "${SPEC}" = "macx-clang" ]; then
DonLakeFlyer's avatar
DonLakeFlyer committed
173
        qmake -r ${TRAVIS_BUILD_DIR}/qgroundcontrol.pro CONFIG+=${CONFIG} CONFIG+=WarningsAsErrorsOn -spec ${SPEC};
174
    else
DonLakeFlyer's avatar
DonLakeFlyer committed
175
        qmake -r ${TRAVIS_BUILD_DIR}/qgroundcontrol.pro CONFIG+=${CONFIG} -spec ${SPEC};
176
    fi
177 178 179 180 181 182

  # 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]});
183
    fi
184
  #- ccache -s
185

Don Gagne's avatar
Don Gagne committed
186 187
  # unit tests linux
  - if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "debug" ]]; then
Don Gagne's avatar
Don Gagne committed
188 189
    	mkdir -p ~/.config/QtProject/ &&
        cp ${TRAVIS_BUILD_DIR}/test/qtlogging.ini ~/.config/QtProject/ &&
Don Gagne's avatar
Don Gagne committed
190
        export QT_FATAL_WARNINGS=1 &&
Don Gagne's avatar
Don Gagne committed
191
        ./debug/qgroundcontrol-start.sh --unittest;
192
    fi
Daniel Agar's avatar
Daniel Agar committed
193

194
after_success:
Daniel Agar's avatar
Daniel Agar committed
195 196
  - cd ${TRAVIS_BUILD_DIR}

197
  # master development builds to beta track
198
  - GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrolbeta
199
  - if [ "${TRAVIS_TAG}" ]; then
200
        GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrol;
201
    elif [ "${TRAVIS_BRANCH}" = "master" ]; then
Daniel Agar's avatar
Daniel Agar committed
202
        GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrolbeta;
203
    else
Daniel Agar's avatar
Daniel Agar committed
204
        GOOGLE_PLAY_PKG=none;
205
    fi
206
  - if [[ "${SPEC}" = "android-clang" && "${TRAVIS_PULL_REQUEST}" = "false" && "${GOOGLE_PLAY_PKG}" != "none" ]]; then
Don Gagne's avatar
Don Gagne committed
207
        pip install --user --upgrade oauth2client &&
208
        pip install --user google-api-python-client pyopenssl ndg-httpsclient pyasn1 &&
Daniel Agar's avatar
Daniel Agar committed
209
        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 &&
210
        ./tools/google_play_upload.py production ${GOOGLE_PLAY_PKG} ${SHADOW_BUILD_DIR}/release/package/QGroundControl${BITNESS}.apk;
211
    fi
212

213 214
before_deploy:
  # create linux appimage
Daniel Agar's avatar
Daniel Agar committed
215
  - cd ${TRAVIS_BUILD_DIR}
216
  - if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "installer" ]]; then
217
        ./deploy/create_linux_appimage.sh ${TRAVIS_BUILD_DIR} ${SHADOW_BUILD_DIR}/release ${SHADOW_BUILD_DIR}/release/package;
218 219
    fi

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

236
  # deploy tagged installers to s3 latest/
237 238 239 240 241 242 243 244 245 246 247 248 249 250
  - 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

251 252 253 254 255 256 257
  # 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
258
    upload-dir: ${TRAVIS_BRANCH}
259 260 261 262 263 264 265
    acl: public_read
    region: us-west-2
    skip_cleanup: true
    on:
      tags: true
      condition: $CONFIG = installer

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

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