.travis.yml 9.71 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 17
    include:
        - os: linux
Don Gagne's avatar
Don Gagne committed
18
          dist: xenial
Daniel Agar's avatar
Daniel Agar committed
19 20
          env: SPEC=linux-g++-64 CONFIG=installer
          sudo: required
21
        - os: linux
Don Gagne's avatar
Don Gagne committed
22
          dist: xenial
23
          env: SPEC=linux-g++-64 CONFIG=debug
Don Gagne's avatar
Don Gagne committed
24
          services: xvfb
25
          sudo: required
26
        - os: android
Don Gagne's avatar
Don Gagne committed
27
          dist: trusty
28 29 30
          language: android
          env: SPEC=android-g++ CONFIG=installer
          sudo: false
Don Gagne's avatar
Don Gagne committed
31
        - os: osx
Don Gagne's avatar
Don Gagne committed
32
          osx_image: xcode9.2
Don Gagne's avatar
Don Gagne committed
33 34
          env: SPEC=macx-clang CONFIG=installer
          sudo: required
35 36 37 38 39
# iOS build needs updating Qt to > 5.10
#        - os: osx
#          osx_image: xcode9.2
#          env: SPEC=macx-ios-clang CONFIG=release
#          sudo: false
40 41
# 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
42
#          osx_image: xcode10.1
43 44
#          env: SPEC=macx-clang CONFIG=debug
#          sudo: required
Daniel Agar's avatar
Daniel Agar committed
45 46 47

android:
  components:
Don Gagne's avatar
Don Gagne committed
48 49
    - android-25
    - build-tools-25.0.3
50
    - platform-tools
Daniel Agar's avatar
Daniel Agar committed
51

52 53 54
addons:
  apt:
    packages:
Don Gagne's avatar
Don Gagne committed
55
    - speech-dispatcher
56 57 58
    - libgstreamer-plugins-base1.0-dev
    - libgstreamer1.0-0:amd64
    - libgstreamer1.0-dev
59
    - libsdl2-dev
60
    - libudev-dev
61
    - wget
62

Daniel Agar's avatar
Daniel Agar committed
63
before_install:
64
  # fetch entire git repo to properly determine the version
65
  - if [ "${CONFIG}" = "installer" ]; then
66
        cd ${TRAVIS_BUILD_DIR} && git fetch --unshallow && git fetch --all --tags;
67
    fi
68 69 70 71 72 73

  # 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));
74
    fi
Daniel Agar's avatar
Daniel Agar committed
75 76

install:
77 78
  # linux dependencies: qt
  - if [ "${SPEC}" = "linux-g++-64" ]; then
Don Gagne's avatar
Don Gagne committed
79 80 81
        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
82 83
        ;
    fi
84 85 86

  # android dependencies: qt, gstreamer, android-ndk
  - if [ "${SPEC}" = "android-g++" ]; then
87
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/gstreamer-1.0-android-universal-1.14.4.tar.bz2 &&
88
        tar jxf gstreamer-1.0-android-universal-1.14.4.tar.bz2 -C ${TRAVIS_BUILD_DIR} &&
89 90
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.11.0-android_armv7-min.tar.bz2 &&
        tar jxf Qt5.11.0-android_armv7-min.tar.bz2 -C /tmp &&
Don Gagne's avatar
Don Gagne committed
91
        wget --quiet https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip &&
Don Gagne's avatar
Don Gagne committed
92
        unzip android-ndk-r16b-linux-x86_64.zip > /dev/null &&
Don Gagne's avatar
Don Gagne committed
93
        export ANDROID_NDK_ROOT=`pwd`/android-ndk-r16b &&
94
        export ANDROID_SDK_ROOT=/usr/local/android-sdk &&
Don Gagne's avatar
Don Gagne committed
95
        export PATH=/tmp/Qt5.11-android_armv7/5.11.0/android_armv7/bin:`pwd`/android-ndk-r16b:$PATH && echo $PATH
96 97 98
        ;
    fi

99
  # osx dependencies: qt (master builds only: gstreamer, gstreamer-devel)
100
  - if [ "${SPEC}" = "macx-clang" ]; then
101 102
        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
103 104 105
        ;
    fi

DonLakeFlyer's avatar
DonLakeFlyer committed
106
  - if [[ "${SPEC}" = "macx-clang" ]]; then
107
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/osx-gstreamer.tar.bz2 &&
108 109 110 111 112
        sudo tar jxf osx-gstreamer.tar.bz2 -C /Library/Frameworks
        ;
    fi

  - if [ "${SPEC}" = "macx-clang" ]; then
113
        export QT_DIR=Qt5.11-clang_64/5.11.0/clang_64 &&
114
        export QT_QPA_PLATFORM_PLUGIN_PATH=/tmp/$QT_DIR/plugins &&
115
        export QML2_IMPORT_PATH=/tmp/$QT_DIR/qml &&
Don Gagne's avatar
Don Gagne committed
116
        export PATH=/tmp/$QT_DIR/bin:$PATH
117 118
        ;
    fi
119

120
  # ios dependencies: qt
121
  - if [ "${SPEC}" = "macx-ios-clang" ]; then
122 123 124 125
        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
126
        tar jxf Qt5.9.3-ios-min.tar.bz2 -C /tmp &&
127
        export IOS_CCACHE_CC=`/usr/bin/xcrun -sdk iphoneos -find clang` &&
128
        export IOS_CCACHE_CXX=`/usr/bin/xcrun -sdk iphoneos -find clang++` &&
129
        export PATH=/tmp/Qt5.9-ios/5.9.3/ios/bin:$PATH
130
        ;
Daniel Agar's avatar
Daniel Agar committed
131 132
    fi

133
before_script:
Daniel Agar's avatar
Daniel Agar committed
134 135
  - cd ${TRAVIS_BUILD_DIR}

136
  # switch android config from installer to release if the android storepass isn't available
137
  - if [[ "${SPEC}" = "android-g++" && "${CONFIG}" = "installer" && -z ${ANDROID_STOREPASS} ]]; then
138
        export CONFIG=release;
139
    fi
140

141
  # insert QGC version in AndroidManifest.xml
142
  - if [ "${SPEC}" = "android-g++" ]; then
143
        git remote set-branches origin 'master' &&
144
        git fetch --tags origin master &&
145
        ./tools/update_android_version.sh;
146
    fi
147 148 149 150

script:
  # run qmake
  - mkdir ${SHADOW_BUILD_DIR} && cd ${SHADOW_BUILD_DIR}
151 152
  # 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
153
        qmake -r ${TRAVIS_BUILD_DIR}/qgroundcontrol.pro CONFIG+=${CONFIG} CONFIG+=WarningsAsErrorsOn -spec ${SPEC};
154
    else
DonLakeFlyer's avatar
DonLakeFlyer committed
155
        qmake -r ${TRAVIS_BUILD_DIR}/qgroundcontrol.pro CONFIG+=${CONFIG} -spec ${SPEC};
156
    fi
157 158 159 160 161 162

  # 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]});
163
    fi
164
  #- ccache -s
165

Don Gagne's avatar
Don Gagne committed
166 167
  # unit tests linux
  - if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "debug" ]]; then
Don Gagne's avatar
Don Gagne committed
168 169 170
    	mkdir -p ~/.config/QtProject/ &&
        cp ${TRAVIS_BUILD_DIR}/test/qtlogging.ini ~/.config/QtProject/ &&
        ./debug/qgroundcontrol-start.sh --unittest;
171
    fi
Daniel Agar's avatar
Daniel Agar committed
172

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

176
  # master development builds to beta track
177
  - GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrolbeta
178
  - if [ "${TRAVIS_TAG}" ]; then
179
        GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrol;
180
    elif [ "${TRAVIS_BRANCH}" = "master" ]; then
Daniel Agar's avatar
Daniel Agar committed
181
        GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrolbeta;
182
    else
Daniel Agar's avatar
Daniel Agar committed
183
        GOOGLE_PLAY_PKG=none;
184
    fi
185
  - if [[ "${SPEC}" = "android-g++" && "${TRAVIS_PULL_REQUEST}" = "false" && "${GOOGLE_PLAY_PKG}" != "none" ]]; then
Don Gagne's avatar
Don Gagne committed
186
        pip install --user --upgrade oauth2client &&
187
        pip install --user google-api-python-client pyopenssl ndg-httpsclient pyasn1 &&
Daniel Agar's avatar
Daniel Agar committed
188
        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 &&
189
        ./tools/google_play_upload.py production ${GOOGLE_PLAY_PKG} ${SHADOW_BUILD_DIR}/release/package/QGroundControl.apk;
190
    fi
191

192 193
before_deploy:
  # create linux appimage
Daniel Agar's avatar
Daniel Agar committed
194
  - cd ${TRAVIS_BUILD_DIR}
195
  - if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "installer" ]]; then
196
        ./deploy/create_linux_appimage.sh ${TRAVIS_BUILD_DIR} ${SHADOW_BUILD_DIR}/release ${SHADOW_BUILD_DIR}/release/package;
197 198
    fi

Daniel Agar's avatar
Daniel Agar committed
199
deploy:
200
  # deploy installers to s3 builds/ if on a branch
Daniel Agar's avatar
Daniel Agar committed
201 202 203 204 205
  - provider: s3
    access_key_id: AKIAIVORNALE7NHD3T6Q
    secret_access_key:
      secure: BsLXeXUPsCJdX4tawrDnO8OFK5Hk4kzlDTiyH93En6TbjUargVAWDMcHVj7TUhr7+3Tao1W1zb0G4SJe9kHv+jrky0yE72KvoG3YAON0VXWKizxBAKkgHE2RxSTNAwDeKbi2G6YJfNDescBBfX7zEohShdXglQu7CGaUQKRaiI4=
    bucket: qgroundcontrol
dogmaphobic's avatar
dogmaphobic committed
206
    local_dir: ${SHADOW_BUILD_DIR}/release/package
207
    upload-dir: builds/${TRAVIS_BRANCH}
Daniel Agar's avatar
Daniel Agar committed
208
    acl: public_read
209
    region: us-west-2
Daniel Agar's avatar
Daniel Agar committed
210 211 212 213
    skip_cleanup: true
    on:
      all_branches: true
      condition: $CONFIG = installer
214

215
  # deploy tagged installers to s3 latest/
216 217 218 219 220 221 222 223 224 225 226 227 228 229
  - 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

230 231 232 233 234 235 236
  # 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
237
    upload-dir: ${TRAVIS_BRANCH}
238 239 240 241 242 243 244
    acl: public_read
    region: us-west-2
    skip_cleanup: true
    on:
      tags: true
      condition: $CONFIG = installer

245
  # deploy installers to Github releases if on a tag
Daniel Agar's avatar
Daniel Agar committed
246 247 248
  - provider: releases
    api-key:
      secure: K/Zqr/FCC7QvzFxYvBtCinPkacQq2ubJ2qm982+38Zf/KjibVOF1dEbVdrGZmII6Tg5DaQzNXGYkg5PvYmJgT9xRsqeQjeYIUYqYZpAt+HYWA38AVfMU8jip/1P1wmwqD469nzJOBBa8yfsMs6Ca7tBaNl/zTxCRGnAgEzqtkdQ=
249
    file_glob: true
Daniel Agar's avatar
Daniel Agar committed
250
    file:
251
      - ${SHADOW_BUILD_DIR}/release/package/qgroundcontrol.*
252
      - ${SHADOW_BUILD_DIR}/release/package/QGroundControl.*
Daniel Agar's avatar
Daniel Agar committed
253 254 255 256
    skip_cleanup: true
    on:
      tags: true
      condition: $CONFIG = installer
257 258 259 260 261

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