.travis.yml 9.98 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 8
    - JOBS=4
    - QT_FATAL_WARNINGS=1
9
    - SHADOW_BUILD_DIR=/tmp/shadow_build_dir
Daniel Agar's avatar
Daniel Agar committed
10
    # ANDROID_STOREPASS
11
    - secure: RGovyUnMw3fp/bHZi058JvANT1rYmNqrsuSYew0cIgirO6YbMHr/rsjwCm1FTYpBl8s1zgr+u2b8ftYnfnCz2YT+Aip4NWrVYpVU0FEmfytGILrnUS0pjlt8m7fU9AKR1ElOSll7yw7e1kftynN39Q321etvwbLZcXon6zz0suE=
Daniel Agar's avatar
Daniel Agar committed
12

13
matrix:
14
    fast_finish: true
15 16
    include:
        - os: linux
Daniel Agar's avatar
Daniel Agar committed
17
          dist: trusty
Daniel Agar's avatar
Daniel Agar committed
18 19
          env: SPEC=linux-g++-64 CONFIG=installer
          sudo: required
20 21 22 23
        - os: linux
          dist: trusty
          env: SPEC=linux-g++-64 CONFIG=debug
          sudo: required
24 25 26 27
        - os: android
          language: android
          env: SPEC=android-g++ CONFIG=installer
          sudo: false
28
        - os: osx
29
          osx_image: xcode9.2
30
          env: SPEC=macx-clang CONFIG=installer
Don Gagne's avatar
Don Gagne committed
31
          sudo: required
Don Gagne's avatar
Don Gagne committed
32
        - os: osx
DonLakeFlyer's avatar
DonLakeFlyer committed
33
          osx_image: xcode9.2
Don Gagne's avatar
Don Gagne committed
34 35
          env: SPEC=macx-ios-clang CONFIG=release
          sudo: false
36 37 38 39 40
# OSX builds pared back to installer only since travis sucks so bad we can't afford more than one'
#        - os: osx
#          osx_image: xcode8
#          env: SPEC=macx-clang CONFIG=debug
#          sudo: required
Daniel Agar's avatar
Daniel Agar committed
41 42 43 44

android:
  components:
    - android-21
45 46
    - build-tools-21.1.1
    - platform-tools
Daniel Agar's avatar
Daniel Agar committed
47

48 49 50 51 52
addons:
  apt:
    packages:
    - espeak
    - libespeak-dev
53 54 55
    - libgstreamer-plugins-base1.0-dev
    - libgstreamer1.0-0:amd64
    - libgstreamer1.0-dev
56
    - libsdl2-dev
57
    - libudev-dev
58
    - wget
59

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

  # 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));
71
    fi
Daniel Agar's avatar
Daniel Agar committed
72 73

install:
74 75
  # linux dependencies: qt
  - if [ "${SPEC}" = "linux-g++-64" ]; then
DonLakeFlyer's avatar
DonLakeFlyer committed
76 77 78
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.9.3-gcc_64-min.tar.bz2 &&
        tar jxf Qt5.9.3-gcc_64-min.tar.bz2 -C /tmp &&
        export PATH=/tmp/Qt5.9-gcc_64/5.9.3/gcc_64/bin:$PATH &&
79
        export DISPLAY=:99.0 &&
Daniel Agar's avatar
Daniel Agar committed
80
        sh -e /etc/init.d/xvfb start
81 82
        ;
    fi
83 84 85

  # android dependencies: qt, gstreamer, android-ndk
  - if [ "${SPEC}" = "android-g++" ]; then
DonLakeFlyer's avatar
DonLakeFlyer committed
86 87
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.9.3-android_armv7-min.tar.bz2 &&
        tar jxf Qt5.9.3-android_armv7-min.tar.bz2 -C /tmp &&
88
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/gstreamer-1.0-android-armv7-1.5.2.tar.bz2 &&
89 90
        mkdir -p ${TRAVIS_BUILD_DIR}/gstreamer-1.0-android-armv7-1.5.2 &&
        tar jxf gstreamer-1.0-android-armv7-1.5.2.tar.bz2 -C ${TRAVIS_BUILD_DIR}/gstreamer-1.0-android-armv7-1.5.2 &&
91
        wget --quiet http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin &&
92 93 94 95
        chmod +x android-ndk-r10e-linux-x86_64.bin &&
        ./android-ndk-r10e-linux-x86_64.bin > /dev/null &&
        export ANDROID_NDK_ROOT=`pwd`/android-ndk-r10e &&
        export ANDROID_SDK_ROOT=/usr/local/android-sdk &&
DonLakeFlyer's avatar
DonLakeFlyer committed
96
        export PATH=/tmp/Qt5.9-android_armv7/5.9.3/android_armv7/bin:`pwd`/android-ndk-r10e:$PATH && echo $PATH
97 98 99
        ;
    fi

100
  # osx dependencies: qt (master builds only: gstreamer, gstreamer-devel)
101
  - if [ "${SPEC}" = "macx-clang" ]; then
DonLakeFlyer's avatar
DonLakeFlyer committed
102 103
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/Qt5.9.3-clang_64-min.tar.bz2 &&
        tar jxf Qt5.9.3-clang_64-min.tar.bz2 -C /tmp
104 105 106
        ;
    fi

107
  - if [[ "${SPEC}" = "macx-clang" && "${TRAVIS_PULL_REQUEST}" = "false" ]]; then
108
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/gstreamer-1.0-1.5.2-x86_64.pkg &&
109 110 111 112
        sudo installer -verboseR -pkg gstreamer-1.0-1.5.2-x86_64.pkg -target /
        ;
    fi

113
  - if [[ "${SPEC}" = "macx-clang" && "${TRAVIS_PULL_REQUEST}" = "false" ]]; then
114
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/gstreamer-1.0-devel-1.5.2-x86_64.pkg &&
115 116 117 118
        sudo installer -verboseR -pkg gstreamer-1.0-devel-1.5.2-x86_64.pkg -target /
        ;
    fi

119
  - if [[ "${SPEC}" = "macx-clang" && "${TRAVIS_PULL_REQUEST}" = "false" ]]; then
120
        wget --quiet https://s3-us-west-2.amazonaws.com/qgroundcontrol/dependencies/osx-gstreamer.tar.bz2 &&
121 122 123 124 125
        sudo tar jxf osx-gstreamer.tar.bz2 -C /Library/Frameworks
        ;
    fi

  - if [ "${SPEC}" = "macx-clang" ]; then
DonLakeFlyer's avatar
DonLakeFlyer committed
126
        export QT_DIR=Qt5.9-clang_64/5.9.3/clang_64 &&
127
        export QT_QPA_PLATFORM_PLUGIN_PATH=/tmp/$QT_DIR/plugins &&
128
        export QML2_IMPORT_PATH=/tmp/$QT_DIR/qml &&
Don Gagne's avatar
Don Gagne committed
129
        export PATH=/tmp/$QT_DIR/bin:$PATH
130 131
        ;
    fi
132

133
  # ios dependencies: qt
134
  - if [ "${SPEC}" = "macx-ios-clang" ]; then
135 136 137 138
        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
139
        tar jxf Qt5.9.3-ios-min.tar.bz2 -C /tmp &&
140
        export IOS_CCACHE_CC=`/usr/bin/xcrun -sdk iphoneos -find clang` &&
141
        export IOS_CCACHE_CXX=`/usr/bin/xcrun -sdk iphoneos -find clang++` &&
142
        export PATH=/tmp/Qt5.9-ios/5.9.3/ios/bin:$PATH
143
        ;
Daniel Agar's avatar
Daniel Agar committed
144 145
    fi

146
before_script:
Daniel Agar's avatar
Daniel Agar committed
147 148
  - cd ${TRAVIS_BUILD_DIR}

149
  # switch android config from installer to release if the android storepass isn't available
150
  - if [[ "${SPEC}" = "android-g++" && "${CONFIG}" = "installer" && -z ${ANDROID_STOREPASS} ]]; then
151
        export CONFIG=release;
152
    fi
153

154
  # insert QGC version in AndroidManifest.xml
155
  - if [ "${SPEC}" = "android-g++" ]; then
156
        git remote set-branches origin 'master' &&
157
        git fetch --tags origin master &&
158
        ./tools/update_android_version.sh;
159
    fi
160 161 162 163 164 165 166 167 168 169 170

script:
  # run qmake
  - mkdir ${SHADOW_BUILD_DIR} && cd ${SHADOW_BUILD_DIR}
  - qmake -r ${TRAVIS_BUILD_DIR}/qgroundcontrol.pro CONFIG+=${CONFIG} CONFIG+=WarningsAsErrorsOn -spec ${SPEC}

  # 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]});
171
    fi
172
  #- ccache -s
173

Don Gagne's avatar
Don Gagne committed
174 175 176
  # unit tests linux
  - if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "debug" ]]; then
    	mkdir -p ~/.config/QtProject/ && cp ${TRAVIS_BUILD_DIR}/test/qtlogging.ini ~/.config/QtProject/ &&
177
            ./debug/qgroundcontrol-start.sh --unittest;
178
    fi
Daniel Agar's avatar
Daniel Agar committed
179

180
after_success:
Daniel Agar's avatar
Daniel Agar committed
181 182
  - cd ${TRAVIS_BUILD_DIR}

183
  # master development builds to beta track
184
  - GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrolbeta
185
  - if [ "${TRAVIS_TAG}" ]; then
186
        GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrol;
187
    elif [ "${TRAVIS_BRANCH}" = "master" ]; then
Daniel Agar's avatar
Daniel Agar committed
188
        GOOGLE_PLAY_PKG=org.mavlink.qgroundcontrolbeta;
189
    else
Daniel Agar's avatar
Daniel Agar committed
190
        GOOGLE_PLAY_PKG=none;
191
    fi
192
  - if [[ "${SPEC}" = "android-g++" && "${TRAVIS_PULL_REQUEST}" = "false" && "${GOOGLE_PLAY_PKG}" != "none" ]]; then
193
        pip install --user google-api-python-client PyOpenSSL &&
Daniel Agar's avatar
Daniel Agar committed
194
        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 &&
195
        ./tools/google_play_upload.py production ${GOOGLE_PLAY_PKG} ${SHADOW_BUILD_DIR}/release/package/QGroundControl.apk;
196
    fi
197

198 199
before_deploy:
  # create linux appimage
Daniel Agar's avatar
Daniel Agar committed
200
  - cd ${TRAVIS_BUILD_DIR}
201
  - if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "installer" ]]; then
202
        ./deploy/create_linux_appimage.sh ${TRAVIS_BUILD_DIR} ${SHADOW_BUILD_DIR}/release ${SHADOW_BUILD_DIR}/release/package;
203 204
    fi

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

221
  # deploy tagged installers to s3 latest/
222 223 224 225 226 227 228 229 230 231 232 233 234 235
  - 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

236 237 238 239 240 241 242
  # 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
243
    upload-dir: ${TRAVIS_BRANCH}
244 245 246 247 248 249 250
    acl: public_read
    region: us-west-2
    skip_cleanup: true
    on:
      tags: true
      condition: $CONFIG = installer

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

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