.travis.yml 11.9 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
jobs:
15
    fast_finish: true
16
    include:
Don Gagne's avatar
Don Gagne committed
17 18
        - stage: "Build"
          name: "Linux Installer"
Don Gagne's avatar
Don Gagne committed
19
          os: linux
20
          dist: bionic
Daniel Agar's avatar
Daniel Agar committed
21 22
          env: SPEC=linux-g++-64 CONFIG=installer
          sudo: required
Don Gagne's avatar
Don Gagne committed
23 24
        - stage: "Build"
          name: "Linux Debug"
Don Gagne's avatar
Don Gagne committed
25
          os: linux
26
          dist: bionic
27
          env: SPEC=linux-g++-64 CONFIG=debug
Don Gagne's avatar
Don Gagne committed
28
          services: xvfb
29
          sudo: required
Don Gagne's avatar
Don Gagne committed
30 31
        - stage: "Build"
          name: "Android 32 bit"
32 33
          dist: trusty
          language: android
34
          env: SPEC=android-clang CONFIG=installer BITNESS=32 GSTREAMER_NAME=armv7
35
          sudo: false
Don Gagne's avatar
Don Gagne committed
36 37
        - stage: "Build"
          name: "Android 64 bit"
Don Gagne's avatar
Don Gagne committed
38
          dist: trusty
Don Gagne's avatar
Don Gagne committed
39
          language: android
40
          env: SPEC=android-clang CONFIG=installer BITNESS=64 GSTREAMER_NAME=arm64
Don Gagne's avatar
Don Gagne committed
41
          sudo: false
Don Gagne's avatar
Don Gagne committed
42 43
        - stage: "Build"
          name: "OSX Installer"
Don Gagne's avatar
Don Gagne committed
44
          os: osx
Don Gagne's avatar
Don Gagne committed
45
          osx_image: xcode11.3
Don Gagne's avatar
Don Gagne committed
46 47
          env: SPEC=macx-clang CONFIG=installer
          sudo: required
Don Gagne's avatar
Don Gagne committed
48
        - stage: "Google Play Upload"
Don Gagne's avatar
Don Gagne committed
49 50 51
          name: "Google Play Upload"
          dist: trusty
          language: android
52
          env: SPEC=google-play-upload
Don Gagne's avatar
Don Gagne committed
53
          sudo: false
54 55 56 57 58
          before_install: skip
          install: skip
          before_script: skip
          before_deploy: skip
          after_deploy: skip
59
          script: echo "Google Play Upload"
Don Gagne's avatar
Don Gagne committed
60
        
61 62 63 64 65
# iOS build needs updating Qt to > 5.10
#        - os: osx
#          osx_image: xcode9.2
#          env: SPEC=macx-ios-clang CONFIG=release
#          sudo: false
66 67
# 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
68
#          osx_image: xcode10.1
69 70
#          env: SPEC=macx-clang CONFIG=debug
#          sudo: required
Daniel Agar's avatar
Daniel Agar committed
71 72 73

android:
  components:
74
    - android-28
Don Gagne's avatar
Don Gagne committed
75
    - build-tools-25.0.3
76
    - platform-tools
Daniel Agar's avatar
Daniel Agar committed
77

78 79 80
addons:
  apt:
    packages:
Don Gagne's avatar
Don Gagne committed
81
    - speech-dispatcher
82 83 84
    - libgstreamer-plugins-base1.0-dev
    - libgstreamer1.0-0:amd64
    - libgstreamer1.0-dev
85
    - libudev-dev
86
    - wget
87

Daniel Agar's avatar
Daniel Agar committed
88
before_install:
89
  # fetch entire git repo to properly determine the version
90
  - if [ "${CONFIG}" = "installer" ]; then
91
        cd ${TRAVIS_BUILD_DIR} && git fetch --unshallow && git fetch --all --tags;
92
    fi
93 94 95 96 97 98

  # 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));
99
    fi
Daniel Agar's avatar
Daniel Agar committed
100

101 102
  # Linux needs sdl2 but not android
  - if [ "${SPEC}" = "linux-g++-64" ]; then
DonLakeFlyer's avatar
DonLakeFlyer committed
103
        sudo apt-get install -y libsdl2-dev libxkbcommon-x11-0;
104 105
    fi

Daniel Agar's avatar
Daniel Agar committed
106
install:
107 108
  # linux dependencies: qt
  - if [ "${SPEC}" = "linux-g++-64" ]; then
DonLakeFlyer's avatar
DonLakeFlyer committed
109 110 111
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.12.6-gcc_64-min.tar.bz2 &&
        tar jxf Qt5.12.6-gcc_64-min.tar.bz2 -C /tmp &&
        export PATH=/tmp/Qt5.12-gcc_64/5.12.6/gcc_64/bin:$PATH
112 113
        ;
    fi
114 115

  # android dependencies: qt, gstreamer, android-ndk
116
  - if [ "${SPEC}" = "android-clang" ]; then
117
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/gstreamer-1.0-android-${GSTREAMER_NAME}-1.14.4.tar.bz2 &&
118
        tar jxf gstreamer-1.0-android-${GSTREAMER_NAME}-1.14.4.tar.bz2 -C ${TRAVIS_BUILD_DIR} &&
119 120 121
        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 &&
122
        export ANDROID_SDK_ROOT=/usr/local/android-sdk &&
Don Gagne's avatar
Don Gagne committed
123 124 125 126
        export PATH=`pwd`/android-ndk-r20:$PATH
        ;
    fi

Don Gagne's avatar
Don Gagne committed
127
  - if [[ "${SPEC}" = "android-clang" && "${BITNESS}" = "64" ]]; then
Don Gagne's avatar
Don Gagne committed
128 129 130
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.12.6-android_arm64_v8a-min.tar.bz2 &&
        tar jxf Qt5.12.6-android_arm64_v8a-min.tar.bz2 -C /tmp &&
        export PATH=/tmp/Qt5.12-android_arm64_v8a/5.12.6/android_arm64_v8a/bin:$PATH
Don Gagne's avatar
Don Gagne committed
131 132 133
        ;
    fi

Don Gagne's avatar
Don Gagne committed
134
  - if [[ "${SPEC}" = "android-clang" && "${BITNESS}" = "32" ]]; then
Don Gagne's avatar
Don Gagne committed
135 136 137
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.12.6-android_armv7-min.tar.bz2 &&
        tar jxf Qt5.12.6-android_armv7-min.tar.bz2 -C /tmp &&
        export PATH=/tmp/Qt5.12-android_armv7/5.12.6/android_armv7/bin:$PATH
138 139 140
        ;
    fi

141
  # osx dependencies: qt (master builds only: gstreamer, gstreamer-devel)
142
  - if [ "${SPEC}" = "macx-clang" ]; then
Don Gagne's avatar
Don Gagne committed
143 144
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.12.6-clang_64-min.tar.bz2 &&
        tar jxf Qt5.12.6-clang_64-min.tar.bz2 -C /tmp
145 146 147
        ;
    fi

DonLakeFlyer's avatar
DonLakeFlyer committed
148
  - if [[ "${SPEC}" = "macx-clang" ]]; then
149
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/osx-gstreamer.tar.bz2 &&
150 151 152 153 154
        sudo tar jxf osx-gstreamer.tar.bz2 -C /Library/Frameworks
        ;
    fi

  - if [ "${SPEC}" = "macx-clang" ]; then
Don Gagne's avatar
Don Gagne committed
155
        export QT_DIR=Qt5.12-clang_64/5.12.6/clang_64 &&
156
        export QT_QPA_PLATFORM_PLUGIN_PATH=/tmp/$QT_DIR/plugins &&
157
        export QML2_IMPORT_PATH=/tmp/$QT_DIR/qml &&
Don Gagne's avatar
Don Gagne committed
158
        export PATH=/tmp/$QT_DIR/bin:$PATH
159 160
        ;
    fi
161

162
  # ios dependencies: qt
163
  - if [ "${SPEC}" = "macx-ios-clang" ]; then
164 165 166 167
        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
168
        tar jxf Qt5.9.3-ios-min.tar.bz2 -C /tmp &&
169
        export IOS_CCACHE_CC=`/usr/bin/xcrun -sdk iphoneos -find clang` &&
170
        export IOS_CCACHE_CXX=`/usr/bin/xcrun -sdk iphoneos -find clang++` &&
171
        export PATH=/tmp/Qt5.9-ios/5.9.3/ios/bin:$PATH
172
        ;
Daniel Agar's avatar
Daniel Agar committed
173 174
    fi

175
before_script:
Daniel Agar's avatar
Daniel Agar committed
176 177
  - cd ${TRAVIS_BUILD_DIR}

178
  # switch android config from installer to release if the android storepass isn't available
179
  - if [[ "${SPEC}" = "android-clang" && "${CONFIG}" = "installer" && -z ${ANDROID_STOREPASS} ]]; then
180
        export CONFIG=release;
181
    fi
182

183
  # insert QGC version in AndroidManifest.xml
184
  - if [ "${SPEC}" = "android-clang" ]; then
185
        git remote set-branches origin 'master' &&
186
        git fetch --tags origin master &&
187
        ./tools/update_android_version.sh ${BITNESS} ${TRAVIS_BRANCH};
188
    fi
189 190 191 192

script:
  # run qmake
  - mkdir ${SHADOW_BUILD_DIR} && cd ${SHADOW_BUILD_DIR}
193
  - if [ "${TRAVIS_TAG}" ]; then
Don Gagne's avatar
Don Gagne committed
194
        echo "Stable build" &&
195 196
        export STABLE_OR_DAILY=StableBuild;
    else
Don Gagne's avatar
Don Gagne committed
197
        echo "Daily build" &&
198 199
        export STABLE_OR_DAILY=DailyBuild;
    fi
200 201
  # 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
202
        qmake -r ${TRAVIS_BUILD_DIR}/qgroundcontrol.pro CONFIG+=${CONFIG} CONFIG+=${STABLE_OR_DAILY} CONFIG+=WarningsAsErrorsOn -spec ${SPEC};
203
    else
204
        qmake -r ${TRAVIS_BUILD_DIR}/qgroundcontrol.pro CONFIG+=${CONFIG} CONFIG+=${STABLE_OR_DAILY} -spec ${SPEC};
205
    fi
206 207 208 209 210 211

  # 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]});
212
    fi
213
  #- ccache -s
214

Don Gagne's avatar
Don Gagne committed
215 216
  # unit tests linux
  - if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "debug" ]]; then
Don Gagne's avatar
Don Gagne committed
217 218
    	mkdir -p ~/.config/QtProject/ &&
        cp ${TRAVIS_BUILD_DIR}/test/qtlogging.ini ~/.config/QtProject/ &&
Don Gagne's avatar
Don Gagne committed
219
        export QT_FATAL_WARNINGS=1 &&
Don Gagne's avatar
Don Gagne committed
220
        ./debug/qgroundcontrol-start.sh --unittest;
221
    fi
Daniel Agar's avatar
Daniel Agar committed
222

223
after_success:
Don Gagne's avatar
Don Gagne committed
224
  # This is only used to upload android builds to Google Play
Daniel Agar's avatar
Daniel Agar committed
225
  - cd ${TRAVIS_BUILD_DIR}
226
  - if [ "${TRAVIS_TAG}" ]; then
227
        GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrol;
228
    elif [ "${TRAVIS_BRANCH}" = "master" ]; then
229
        GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrolbeta;
230
    else
Daniel Agar's avatar
Daniel Agar committed
231
        GOOGLE_PLAY_PKG=none;
232
    fi
233
  - if [[ "${SPEC}" = "google-play-upload" && "${TRAVIS_PULL_REQUEST}" = "false" && "${GOOGLE_PLAY_PKG}" != "none" ]]; then
Don Gagne's avatar
Don Gagne committed
234 235
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/builds/${TRAVIS_BRANCH}/QGroundControl32.apk &&
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/builds/${TRAVIS_BRANCH}/QGroundControl64.apk &&
236 237 238
        pip install --user --upgrade oauth2client &&
        pip install --user google-api-python-client pyopenssl ndg-httpsclient pyasn1 &&
        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 &&
Don Gagne's avatar
Don Gagne committed
239
        ./deploy/GooglePlayUpload.py ${GOOGLE_PLAY_PKG};
240
    fi
241

242 243
before_deploy:
  # create linux appimage
Daniel Agar's avatar
Daniel Agar committed
244
  - cd ${TRAVIS_BUILD_DIR}
245
  - if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "installer" ]]; then
246
        ./deploy/create_linux_appimage.sh ${TRAVIS_BUILD_DIR} ${SHADOW_BUILD_DIR}/release ${SHADOW_BUILD_DIR}/release/package;
247 248
    fi

Daniel Agar's avatar
Daniel Agar committed
249
deploy:
250
  # deploy installers to s3 builds/ if on a branch
Daniel Agar's avatar
Daniel Agar committed
251
  - provider: s3
Don Gagne's avatar
Don Gagne committed
252
    edge: true # Use V2 provider to work around V1 bug
Daniel Agar's avatar
Daniel Agar committed
253 254 255 256
    access_key_id: AKIAIVORNALE7NHD3T6Q
    secret_access_key:
      secure: BsLXeXUPsCJdX4tawrDnO8OFK5Hk4kzlDTiyH93En6TbjUargVAWDMcHVj7TUhr7+3Tao1W1zb0G4SJe9kHv+jrky0yE72KvoG3YAON0VXWKizxBAKkgHE2RxSTNAwDeKbi2G6YJfNDescBBfX7zEohShdXglQu7CGaUQKRaiI4=
    bucket: qgroundcontrol
dogmaphobic's avatar
dogmaphobic committed
257
    local_dir: ${SHADOW_BUILD_DIR}/release/package
258
    upload-dir: builds/${TRAVIS_BRANCH}
Daniel Agar's avatar
Daniel Agar committed
259
    acl: public_read
260
    region: us-west-2
Daniel Agar's avatar
Daniel Agar committed
261 262 263 264
    skip_cleanup: true
    on:
      all_branches: true
      condition: $CONFIG = installer
265

266
  # deploy tagged installers to s3 latest/
267
  - provider: s3
Don Gagne's avatar
Don Gagne committed
268
    edge: true # Use V2 provider to work around V1 bug
269 270 271 272 273 274 275 276 277 278 279 280 281
    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

282 283
  # deploy tagged installers to s3 version folder
  - provider: s3
Don Gagne's avatar
Don Gagne committed
284
    edge: true # Use V2 provider to work around V1 bug
285 286 287 288 289
    access_key_id: AKIAIVORNALE7NHD3T6Q
    secret_access_key:
      secure: BsLXeXUPsCJdX4tawrDnO8OFK5Hk4kzlDTiyH93En6TbjUargVAWDMcHVj7TUhr7+3Tao1W1zb0G4SJe9kHv+jrky0yE72KvoG3YAON0VXWKizxBAKkgHE2RxSTNAwDeKbi2G6YJfNDescBBfX7zEohShdXglQu7CGaUQKRaiI4=
    bucket: qgroundcontrol
    local_dir: ${SHADOW_BUILD_DIR}/release/package
290
    upload-dir: ${TRAVIS_BRANCH}
291 292 293 294 295 296 297
    acl: public_read
    region: us-west-2
    skip_cleanup: true
    on:
      tags: true
      condition: $CONFIG = installer

298
  # deploy installers to Github releases if on a tag
Daniel Agar's avatar
Daniel Agar committed
299
  - provider: releases
Don Gagne's avatar
Don Gagne committed
300
    edge: true # Use V2 provider to work around V1 bug
Daniel Agar's avatar
Daniel Agar committed
301 302
    api-key:
      secure: K/Zqr/FCC7QvzFxYvBtCinPkacQq2ubJ2qm982+38Zf/KjibVOF1dEbVdrGZmII6Tg5DaQzNXGYkg5PvYmJgT9xRsqeQjeYIUYqYZpAt+HYWA38AVfMU8jip/1P1wmwqD469nzJOBBa8yfsMs6Ca7tBaNl/zTxCRGnAgEzqtkdQ=
303
    file_glob: true
Daniel Agar's avatar
Daniel Agar committed
304
    file:
305
      - ${SHADOW_BUILD_DIR}/release/package/qgroundcontrol.*
306
      - ${SHADOW_BUILD_DIR}/release/package/QGroundControl.*
Daniel Agar's avatar
Daniel Agar committed
307 308 309 310
    skip_cleanup: true
    on:
      tags: true
      condition: $CONFIG = installer
311
      condition: $SPEC != macx-clang # GitHub OSX deploy broken due to travis problem
312 313 314 315 316

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