.travis.yml 10.7 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
28 29 30 31 32
        - name: "Android 32 bit"
          dist: trusty
          language: android
          env: SPEC=android-clang CONFIG=installer BITNESS=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: xcode11.3
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:
56
    - android-28
Don Gagne's avatar
Don Gagne committed
57
    - 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
    - libudev-dev
68
    - wget
69

Daniel Agar's avatar
Daniel Agar committed
70
before_install:
71
  # fetch entire git repo to properly determine the version
72
  - if [ "${CONFIG}" = "installer" ]; then
73
        cd ${TRAVIS_BUILD_DIR} && git fetch --unshallow && git fetch --all --tags;
74
    fi
75 76 77 78 79 80

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

83 84
  # Linux needs sdl2 but not android
  - if [ "${SPEC}" = "linux-g++-64" ]; then
DonLakeFlyer's avatar
DonLakeFlyer committed
85
        sudo apt-get install -y libsdl2-dev libxkbcommon-x11-0;
86 87
    fi

Daniel Agar's avatar
Daniel Agar committed
88
install:
89 90
  # linux dependencies: qt
  - if [ "${SPEC}" = "linux-g++-64" ]; then
DonLakeFlyer's avatar
DonLakeFlyer committed
91 92 93
        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
94 95
        ;
    fi
96 97

  # android dependencies: qt, gstreamer, android-ndk
98
  - if [ "${SPEC}" = "android-clang" ]; then
99
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/gstreamer-1.0-android-universal-1.14.4.tar.bz2 &&
100
        tar jxf gstreamer-1.0-android-universal-1.14.4.tar.bz2 -C ${TRAVIS_BUILD_DIR} &&
101 102 103
        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 &&
104
        export ANDROID_SDK_ROOT=/usr/local/android-sdk &&
Don Gagne's avatar
Don Gagne committed
105 106 107 108
        export PATH=`pwd`/android-ndk-r20:$PATH
        ;
    fi

Don Gagne's avatar
Don Gagne committed
109
  - if [[ "${SPEC}" = "android-clang" && "${BITNESS}" = "64" ]]; then
Don Gagne's avatar
Don Gagne committed
110 111 112
        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
113 114 115
        ;
    fi

Don Gagne's avatar
Don Gagne committed
116
  - if [[ "${SPEC}" = "android-clang" && "${BITNESS}" = "32" ]]; then
Don Gagne's avatar
Don Gagne committed
117 118 119
        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
120 121 122
        ;
    fi

123
  # osx dependencies: qt (master builds only: gstreamer, gstreamer-devel)
124
  - if [ "${SPEC}" = "macx-clang" ]; then
Don Gagne's avatar
Don Gagne committed
125 126
        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
127 128 129
        ;
    fi

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

  - if [ "${SPEC}" = "macx-clang" ]; then
Don Gagne's avatar
Don Gagne committed
137
        export QT_DIR=Qt5.12-clang_64/5.12.6/clang_64 &&
138
        export QT_QPA_PLATFORM_PLUGIN_PATH=/tmp/$QT_DIR/plugins &&
139
        export QML2_IMPORT_PATH=/tmp/$QT_DIR/qml &&
Don Gagne's avatar
Don Gagne committed
140
        export PATH=/tmp/$QT_DIR/bin:$PATH
141 142
        ;
    fi
143

144
  # ios dependencies: qt
145
  - if [ "${SPEC}" = "macx-ios-clang" ]; then
146 147 148 149
        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
150
        tar jxf Qt5.9.3-ios-min.tar.bz2 -C /tmp &&
151
        export IOS_CCACHE_CC=`/usr/bin/xcrun -sdk iphoneos -find clang` &&
152
        export IOS_CCACHE_CXX=`/usr/bin/xcrun -sdk iphoneos -find clang++` &&
153
        export PATH=/tmp/Qt5.9-ios/5.9.3/ios/bin:$PATH
154
        ;
Daniel Agar's avatar
Daniel Agar committed
155 156
    fi

157
before_script:
Daniel Agar's avatar
Daniel Agar committed
158 159
  - cd ${TRAVIS_BUILD_DIR}

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

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

script:
  # run qmake
  - mkdir ${SHADOW_BUILD_DIR} && cd ${SHADOW_BUILD_DIR}
175 176
  # 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
177
        qmake -r ${TRAVIS_BUILD_DIR}/qgroundcontrol.pro CONFIG+=${CONFIG} CONFIG+=WarningsAsErrorsOn -spec ${SPEC};
178
    else
DonLakeFlyer's avatar
DonLakeFlyer committed
179
        qmake -r ${TRAVIS_BUILD_DIR}/qgroundcontrol.pro CONFIG+=${CONFIG} -spec ${SPEC};
180
    fi
181 182 183 184 185 186

  # 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]});
187
    fi
188
  #- ccache -s
189

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

198
after_success:
Daniel Agar's avatar
Daniel Agar committed
199 200
  - cd ${TRAVIS_BUILD_DIR}

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

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

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

240
  # deploy tagged installers to s3 latest/
241 242 243 244 245 246 247 248 249 250 251 252 253 254
  - 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

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

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

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