.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
8
    - SHADOW_BUILD_DIR=/tmp/shadow_build_dir
9
    - CODESIGN=nocodesign
10
    - secure: RGovyUnMw3fp/bHZi058JvANT1rYmNqrsuSYew0cIgirO6YbMHr/rsjwCm1FTYpBl8s1zgr+u2b8ftYnfnCz2YT+Aip4NWrVYpVU0FEmfytGILrnUS0pjlt8m7fU9AKR1ElOSll7yw7e1kftynN39Q321etvwbLZcXon6zz0suE=
Daniel Agar's avatar
Daniel Agar committed
11

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

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

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

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

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

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

Daniel Agar's avatar
Daniel Agar committed
104
install:
105 106
  # linux dependencies: qt
  - if [ "${SPEC}" = "linux-g++-64" ]; then
DonLakeFlyer's avatar
DonLakeFlyer committed
107 108 109
        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
110 111
        ;
    fi
112 113

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

Don Gagne's avatar
Don Gagne committed
125
  - if [[ "${SPEC}" = "android-clang" && "${BITNESS}" = "64" ]]; then
Don Gagne's avatar
Don Gagne committed
126 127 128
        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
129 130 131
        ;
    fi

Don Gagne's avatar
Don Gagne committed
132
  - if [[ "${SPEC}" = "android-clang" && "${BITNESS}" = "32" ]]; then
Don Gagne's avatar
Don Gagne committed
133 134 135
        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
136 137 138
        ;
    fi

139
  # osx dependencies: qt (master builds only: gstreamer, gstreamer-devel)
140
  - if [ "${SPEC}" = "macx-clang" ]; then
Don Gagne's avatar
Don Gagne committed
141 142
        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
143 144 145
        ;
    fi

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

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

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

173
before_script:
Daniel Agar's avatar
Daniel Agar committed
174 175
  - cd ${TRAVIS_BUILD_DIR}

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

181
  # insert QGC version in AndroidManifest.xml
182
  - if [ "${SPEC}" = "android-clang" ]; then
183
        git remote set-branches origin 'master' &&
184
        git fetch --tags origin master &&
185
        ./tools/update_android_version.sh ${BITNESS} ${TRAVIS_BRANCH};
186
    fi
Don Gagne's avatar
Don Gagne committed
187 188
    
  # Install signing cert into OSX keychain
189
  - if [[ "${SPEC}" = "macx-clang" && "${TRAVIS_PULL_REQUEST}" = "false" ]]; then
Don Gagne's avatar
Don Gagne committed
190 191
        export CODESIGN=codesign;
    fi
192
  - if [[ "${SPEC}" = "macx-clang" && "${TRAVIS_PULL_REQUEST}" = "false" ]]; then
Don Gagne's avatar
Don Gagne committed
193 194
        openssl aes-256-cbc -K $MAC_CERT_KEY -iv $MAC_CERT_IV -in deploy/MacCertificates.p12.enc -out deploy/MacCertificates.p12 -d;
    fi
195
  - if [[ "${SPEC}" = "macx-clang" && "${TRAVIS_PULL_REQUEST}" = "false" ]]; then
Don Gagne's avatar
Don Gagne committed
196
        source deploy/MacImportCert.sh;
Don Gagne's avatar
Don Gagne committed
197
    fi
198 199 200 201

script:
  # run qmake
  - mkdir ${SHADOW_BUILD_DIR} && cd ${SHADOW_BUILD_DIR}
202
  - if [ "${TRAVIS_TAG}" ]; then
Don Gagne's avatar
Don Gagne committed
203
        echo "Stable build" &&
204 205
        export STABLE_OR_DAILY=StableBuild;
    else
Don Gagne's avatar
Don Gagne committed
206
        echo "Daily build" &&
207 208
        export STABLE_OR_DAILY=DailyBuild;
    fi
209
  - qmake -r ${TRAVIS_BUILD_DIR}/qgroundcontrol.pro CONFIG+=${CONFIG} CONFIG+=${STABLE_OR_DAILY} CONFIG+=${CODESIGN} -spec ${SPEC};
210 211 212 213 214 215

  # 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]});
216
    fi
217
  #- ccache -s
218

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

227
after_success:
Don Gagne's avatar
Don Gagne committed
228
  # This is only used to upload android builds to Google Play
Daniel Agar's avatar
Daniel Agar committed
229
  - cd ${TRAVIS_BUILD_DIR}
230
  - if [ "${TRAVIS_TAG}" ]; then
231
        GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrol;
232
    elif [ "${TRAVIS_BRANCH}" = "master" ]; then
233
        GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrolbeta;
234
    else
Daniel Agar's avatar
Daniel Agar committed
235
        GOOGLE_PLAY_PKG=none;
236
    fi
237
  - if [[ "${SPEC}" = "google-play-upload" && "${TRAVIS_PULL_REQUEST}" = "false" && "${GOOGLE_PLAY_PKG}" != "none" ]]; then
Don Gagne's avatar
Don Gagne committed
238 239
        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 &&
240 241 242
        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
243
        ./deploy/GooglePlayUpload.py ${GOOGLE_PLAY_PKG};
244
    fi
245

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

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

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

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

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

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