.travis.yml 11.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
    - 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 194
  # 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
195
        qmake -r ${TRAVIS_BUILD_DIR}/qgroundcontrol.pro CONFIG+=${CONFIG} CONFIG+=WarningsAsErrorsOn -spec ${SPEC};
196
    else
DonLakeFlyer's avatar
DonLakeFlyer committed
197
        qmake -r ${TRAVIS_BUILD_DIR}/qgroundcontrol.pro CONFIG+=${CONFIG} -spec ${SPEC};
198
    fi
199 200 201 202 203 204

  # 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]});
205
    fi
206
  #- ccache -s
207

Don Gagne's avatar
Don Gagne committed
208 209
  # unit tests linux
  - if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "debug" ]]; then
Don Gagne's avatar
Don Gagne committed
210 211
    	mkdir -p ~/.config/QtProject/ &&
        cp ${TRAVIS_BUILD_DIR}/test/qtlogging.ini ~/.config/QtProject/ &&
Don Gagne's avatar
Don Gagne committed
212
        export QT_FATAL_WARNINGS=1 &&
Don Gagne's avatar
Don Gagne committed
213
        ./debug/qgroundcontrol-start.sh --unittest;
214
    fi
Daniel Agar's avatar
Daniel Agar committed
215

216
after_success:
Don Gagne's avatar
Don Gagne committed
217
  # This is only used to upload android builds to Google Play
Daniel Agar's avatar
Daniel Agar committed
218
  - cd ${TRAVIS_BUILD_DIR}
219
  - if [ "${TRAVIS_TAG}" ]; then
220
        GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrol;
221
    elif [ "${TRAVIS_BRANCH}" = "master" ]; then
222
        GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrolbeta;
223
    else
Daniel Agar's avatar
Daniel Agar committed
224
        GOOGLE_PLAY_PKG=none;
225
    fi
226
  - if [[ "${SPEC}" = "google-play-upload" && "${TRAVIS_PULL_REQUEST}" = "false" && "${GOOGLE_PLAY_PKG}" != "none" ]]; then
Don Gagne's avatar
Don Gagne committed
227 228
        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 &&
229 230 231
        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
232
        ./deploy/GooglePlayUpload.py ${GOOGLE_PLAY_PKG};
233
    fi
234

235 236
before_deploy:
  # create linux appimage
Daniel Agar's avatar
Daniel Agar committed
237
  - cd ${TRAVIS_BUILD_DIR}
238
  - if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "installer" ]]; then
239
        ./deploy/create_linux_appimage.sh ${TRAVIS_BUILD_DIR} ${SHADOW_BUILD_DIR}/release ${SHADOW_BUILD_DIR}/release/package;
240 241
    fi

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

259
  # deploy tagged installers to s3 latest/
260
  - provider: s3
Don Gagne's avatar
Don Gagne committed
261
    edge: true # Use V2 provider to work around V1 bug
262 263 264 265 266 267 268 269 270 271 272 273 274
    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

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

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

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