forked from openfoodfacts/openfoodfacts-androidapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
113 lines (95 loc) · 5.55 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
language: android
jdk: oraclejdk8
# Currently Travis doesn't have a Ubuntu Xenial image for "language: android"
# If the distribution is omitted it falls back to Ubuntu Precise instead of Trusty, making the build unstable
dist: trusty
env:
global:
- ABI=x86_64
- API=25
- ANDROID_API=27
- EMU_FLAVOR=default # use google_apis flavor if no default flavor emulator
# PATH order is incredibly important. e.g. the 'emulator' script exists in more than one place!
- ANDROID_HOME=/usr/local/android-sdk
- TOOLS=${ANDROID_HOME}/tools
- PATH=${ANDROID_HOME}:${ANDROID_HOME}/emulator:${TOOLS}:${TOOLS}/bin:${ANDROID_HOME}/platform-tools:${PATH}
- ADB_INSTALL_TIMEOUT=20 # minutes (2 minutes by default)
- secure: "fpNJresszWHcOg8Qh4plu2RJFOv9AzCMh2dVV2SbwWNRuf2j15raDdFGhCD2tEM7ddhqrfHgmiwqFSWCzjWw1azx0ovGJfFhikLM741pLb68S/EkOdvl9RU6DXeC6+Tyg0iaustgkoK24kwkzx/kg3o56TyFg1g2ufsQqfEseJtOGVQEh86zj8ncfU60VcMP7HHqHZMjlZaQ+G0Ale4ofzQzmAbiNiNPjykMbjDhzdKMTeZLXnj8S59twI1y/D/JdfKCiq/xOnO3HbIZBZ4A3nVb/fV5WCR4Kw6LRzoNE9qYnxJFaeIYSF9+YDDol9PbQRWTX5EgDnJBbZqj8aSYUEk3WUGRnDCKYR0R/v/BhTfnLIp1jBQWyhDJ56iPZ+tgRfChMejsf8aH8agPwczjfbX8H/1NLzBAtF/elA67dPaoQMqb33nO8D+ESIIyYNsK4CyfeDF6/qT/IcBBa7FUfhIOHjwLnaeCyZS78eq2QUSNkDaATKM8BUot+hGMTenBpivEDKL1L+twFFFKjNK3HkvnJ2H92P/EgT7OUVSuPnD5czfK3WydMmbimChKoygSq5/62tC6FMHUNdNj7pHnfJWTdSj+RgNJKVTasPJAQ1B+pU/z+TZVJMsBpME2CTtNGC6+o9W/6K5FMUt/2J/P63RHJqXXZLtttphN3tg7eLo="
android:
components:
- tools
licenses:
- 'android-sdk-preview-license-.+'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
before_cache:
# Do not cache a few Gradle files/directories (see https://docs.travis-ci.com/user/languages/java/#Caching)
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
# Gradle dependencies
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
# Cache maven
- $HOME/.m2
before_script:
# Create and start emulator.
- echo 'count=0' > /home/travis/.android/repositories.cfg # Avoid harmless sdkmanager warning
- echo y | sdkmanager "platform-tools" >/dev/null
- echo y | sdkmanager "tools" >/dev/null # A second time per Travis docs, gets latest versions
- echo y | sdkmanager "build-tools;$ANDROID_API.0.3" >/dev/null # Implicit gradle dependency - gradle drives changes
- echo y | sdkmanager "platforms;android-$API" >/dev/null # We need the API of the emulator we will run
- echo y | sdkmanager "platforms;android-$ANDROID_API" >/dev/null # We need the API of the current compileSdkVersion from gradle.properties
- echo y | sdkmanager --channel=4 "emulator" >/dev/null # Use canary channel to get emulator 29.x for x86_64 image support
- echo y | sdkmanager "extras;android;m2repository" >/dev/null
- echo y | sdkmanager "system-images;android-$API;$EMU_FLAVOR;$ABI" >/dev/null # install our emulator
- echo no | avdmanager create avd --force -n test -k "system-images;android-$API;$EMU_FLAVOR;$ABI" -c 10M
- emulator -verbose -avd test -no-accel -no-snapshot -no-window $AUDIO -selinux permissive -qemu -m 2048 &
- android-wait-for-emulator
- adb shell input keyevent 82 &
jobs:
include:
- stage: test
script:
#launch
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then ./gradlew sonarqube -Dsonar.projectKey=openfoodfacts_openfoodfacts-androidapp -Dsonar.organization=openfoodfacts -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN; fi
- stage: test
script:
- ./gradlew compileOffScreenshotsAndroidTestSources --stacktrace --info -PtestBuildType=screenshots
- stage: test
script:
- ./gradlew testObfDebugUnitTest connectedObfDebugAndroidTest assembleObfDebug --stacktrace
- mv app/build/outputs/apk/obf/debug/app-obf-debug.apk app/build/outputs/apk/app-obf-debug-$TRAVIS_BRANCH.apk
- stage: test
script:
- ./gradlew testOffDebugUnitTest connectedOffDebugAndroidTest assembleOffDebug --stacktrace
- mv app/build/outputs/apk/off/debug/app-off-debug.apk app/build/outputs/apk/app-off-debug-$TRAVIS_BRANCH.apk
- stage: test
script:
- ./gradlew testOpfDebugUnitTest connectedOpfDebugAndroidTest assembleOpfDebug --stacktrace
- mv app/build/outputs/apk/opf/debug/app-opf-debug.apk app/build/outputs/apk/app-opf-debug-$TRAVIS_BRANCH.apk
- stage: test
script:
- ./gradlew testOpffDebugUnitTest connectedOpffDebugAndroidTest assembleOpffDebug --stacktrace
- mv app/build/outputs/apk/opff/debug/app-opff-debug.apk app/build/outputs/apk/app-opff-debug-$TRAVIS_BRANCH.apk
sudo: required
notifications:
email: false
slack: openfoodfacts:mXLLSlWjBKA9e03ELQ83rNvB
before_deploy:
# no GIT tag for debug apk
- export TRAVIS_TAG=UNTAGGED
deploy:
provider: releases
skip_cleanup: true
overwrite: true
draft: true
file_glob: true
api_key:
secure: 1+rM47r/FmpfGHQRvO2DowV5qSlulmsQZseQ408Dra9HermLs8//HUTDEr+FZhJjnmUut6ykS1l7PalbQXdoNaHJSqe/BmD7crGYn/Cu/n0kRREzkCbl/YfH2oyRfP1wqMFWrMB+ItDgDU/MKnzi1JZRWTxNixoACPfGnTWTeu7iMeVkzIwr0LqBPSN8T1dOi8Kbd1KLXD59oUxb3eB+KIfZreP3Ro+mT8K89D44DVTyl6DuXzHaI/XivjAofq4hdsMs+X9YBVsH3iAnF8g0WvPfcfI881SQ20mQglJo7WL+97EtSqOgHk5dnTDKrkfrRU6OkFJ4yclkRSOaKoLKpCAJN9sJw8F4Mqip7PhF9hcUFI0LNjaZE28/anN55beNqs6AoZuaoesybGZWkxXTqKkWIryyWVsjy8MdjKRLKMBKQ1bIUafJ/K6itQL/doX2XbWToHT49zyIg8GT5nsjByM6i4nfHf5kcE8aCkZr16CH9/C44lEm7dSow+Pc+OOaYn81Ecgy9FEhk+plAgulgI+Xk9VqnheNdklcjJazbtjSaae+DbmOHkD1kLBsd7ENatE1nQVShwL7uMleSviamySgRaJTpmReR1UFMET5oYpRt9XHMJK47x1EsUtrwopgeghy1sUKNpQq/d5QpdFDyzI4MFBl/lZKe9r9TeyaGxg=
file: app/build/outputs/apk/*.apk
on:
all_branches: true
git:
depth: false