Skip to content
This repository was archived by the owner on Dec 28, 2022. It is now read-only.

Commit 99f7615

Browse files
committed
Travis - manually download & cache Android SDK
- Don't use gradle daemon (daemon not recommended for CI environments) - Enable parallel execution - Removed unused 'git depth' hack from travis.yml (cherry picked from commit 7527e31)
1 parent 42c3e71 commit 99f7615

File tree

3 files changed

+101
-29
lines changed

3 files changed

+101
-29
lines changed

.travis.yml

+99-27
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,114 @@ jdk: oraclejdk8
44

55
sudo: required
66

7-
android:
8-
components:
9-
- tools
10-
- platform-tools
11-
- build-tools-28.0.3
12-
- android-28
13-
- extra-android-support
14-
- extra-android-m2repository
15-
- extra-google-m2repository
16-
licenses:
17-
- ".+"
18-
19-
# Increase travis 'git depth' from default of 50, to 10000. Potential fix for commit count issue.
20-
git:
21-
depth: 10000
7+
before_cache:
8+
# Do not cache a few Gradle files/directories (see https://docs.travis-ci.com/user/languages/java/#Caching)
9+
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
10+
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
2211

23-
script:
24-
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash .travis/run_on_pull_requests; fi
25-
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash .travis/run_on_non_pull_requests; fi
12+
cache:
13+
directories:
14+
# Android SDK
15+
- $HOME/android-sdk-dl
16+
- $HOME/android-sdk
17+
# Gradle dependencies
18+
- $HOME/.gradle/caches/
19+
- $HOME/.gradle/wrapper/
20+
# Android build cache (see http://tools.android.com/tech-docs/build-cache)
21+
- $HOME/.android/build-cache
22+
language: android
2623

27-
before_install:
28-
- yes | sdkmanager "platforms;android-28"
29-
- mkdir "$ANDROID_HOME/licenses" || true
30-
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
31-
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
32-
- echo y | android update sdk --no-ui --all --filter build-tools-28.0.3
24+
jdk: oraclejdk8
25+
26+
sudo: required
3327

3428
before_cache:
29+
# Do not cache a few Gradle files/directories (see https://docs.travis-ci.com/user/languages/java/#Caching)
3530
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
3631
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
3732

3833
cache:
3934
directories:
40-
- "$HOME/.gradle/caches/"
41-
- "$HOME/.gradle/wrapper/"
42-
- "$HOME/.android/build-cache"
35+
# Android SDK
36+
- $HOME/android-sdk-dl
37+
- $HOME/android-sdk
38+
# Gradle dependencies
39+
- $HOME/.gradle/caches/
40+
- $HOME/.gradle/wrapper/
41+
# Android build cache (see http://tools.android.com/tech-docs/build-cache)
42+
- $HOME/.android/build-cache
43+
44+
install:
45+
# Download and unzip the Android SDK tools (if not already there thanks to the cache mechanism)
46+
# Latest version available here: https://developer.android.com/studio/#command-tools
47+
- if test ! -e $HOME/android-sdk-dl/sdk-tools.zip ; then curl https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip > $HOME/android-sdk-dl/sdk-tools.zip ; fi
48+
- unzip -qq -n $HOME/android-sdk-dl/sdk-tools.zip -d $HOME/android-sdk
49+
50+
# Install or update Android SDK components (will not do anything if already up to date thanks to the cache mechanism)
51+
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'tools' > /dev/null
52+
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'platform-tools' > /dev/null
53+
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'build-tools;28.0.3' > /dev/null
54+
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'platforms;android-28' > /dev/null
55+
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'extras;google;m2repository' > /dev/null
56+
57+
env:
58+
- ANDROID_HOME=$HOME/android-sdk
59+
60+
script:
61+
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash .travis/run_on_pull_requests; fi
62+
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash .travis/run_on_non_pull_requests; fi
63+
64+
deploy:
65+
66+
# Github alpha/beta/release
67+
- provider: releases
68+
api_key:
69+
secure: y/DY5he0HhCR1M4B4eKuhjvcpNYDAKCg89g3Bw7YAla10sYS5EJch3QQorLzTdSSFZuuufaue5524ap4mNAyB1RClw5waDwSbmhk96xdVFGak6u1Hzc3yTb7YaFmLtmWY93kCcpXOHkqqf/M7QwG4FlilwKhTiEa6YcB+U78JA3pVx1TLTezW+E79wJkB6yGY0nlzRUYZG2z1IqpIE8Cgj56T2gpBHLfJCcPkcM56d4hhxrs+pWqkF0Y2pFtNI8CxzqQlGXYoakW/QEZ5GDCkuvwNro5RhJZx6Vr7uMBmh2Rq+xwIvnwA4ljXrl8pwJVwua/g7NvQGdWaEsWJkVaEOqARbDWs3OJlBvmGBMldkwnbBDHMzHD6BTDwum+qIllr1V5skIqib6xwPw8qPk40QpjldaHRvRwqqpjNrHJ4jc44LoUTrCS9HT0pXiUT2HBQPWGZ+fg7rMIS1x7psRFQ7bjz9T/AHYkAqTZC5BqfezHh19RZdco2p+1rHCWEOZnLUJi9IJtXdpNeCPdllwPIEra4+2RdCPV6ASXf7GhQX5e/NmdCMAAaABxgRH8wiycYeEYTySBeeNWAB7u3ctY+CKUHm77P21myJi7+oolW4LaZw4J/RcjFny26AYKVtPYXVJ8AwV/epdpxiiEciiCf2nujmVFpLqKXMIV7La9LCc=
70+
file: app/build/outputs/apk/free/release/app-free-release.apk
71+
file_glob: 'true'
72+
skip_cleanup: true
73+
on:
74+
repo: timusus/Shuttle
75+
tags: true
76+
condition: $TRAVIS_TAG =~ beta || $TRAVIS_TAG =~ alpha || $TRAVIS_TAG =~ release || $TRAVIS_TAG =~ rollout
77+
78+
# Play Store beta release
79+
- provider: script
80+
script: ./gradlew publishApkFreeRelease publishApkPaidRelease
81+
skip_cleanup: true
82+
on:
83+
repo: timusus/Shuttle
84+
tags: true
85+
condition: $TRAVIS_TAG =~ beta || $TRAVIS_TAG =~ alpha || $TRAVIS_TAG =~ release || $TRAVIS_TAG =~ rollout
86+
87+
# Slack build notifications
88+
notifications:
89+
slack:
90+
rooms:
91+
- shuttlemusicplayer:g90QK9lL6Hg5jfzegqjjNqqN
92+
on_pull_requests: false
93+
template:
94+
- "Build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}: '%{commit_subject}'>) by %{author} %{result} in %{duration}."
95+
96+
install:
97+
# Download and unzip the Android SDK tools (if not already there thanks to the cache mechanism)
98+
# Latest version available here: https://developer.android.com/studio/#command-tools
99+
- if test ! -e $HOME/android-sdk-dl/sdk-tools.zip ; then curl https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip > $HOME/android-sdk-dl/sdk-tools.zip ; fi
100+
- unzip -qq -n $HOME/android-sdk-dl/sdk-tools.zip -d $HOME/android-sdk
101+
102+
# Install or update Android SDK components (will not do anything if already up to date thanks to the cache mechanism)
103+
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'tools' > /dev/null
104+
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'platform-tools' > /dev/null
105+
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'build-tools;28.0.3' > /dev/null
106+
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'platforms;android-28' > /dev/null
107+
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'extras;google;m2repository' > /dev/null
108+
109+
env:
110+
- ANDROID_HOME=$HOME/android-sdk
111+
112+
script:
113+
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash .travis/run_on_pull_requests; fi
114+
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash .travis/run_on_non_pull_requests; fi
43115
44116
deploy:
45117

.travis/run_on_non_pull_requests

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ tar xvf secrets.tar
1010

1111
# For non pull-requests, build & test everything.
1212

13-
./gradlew build
13+
./gradlew --no-daemon -parallel build

.travis/run_on_pull_requests

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
set -e
44

55
# For pull requests, just assemble & test the debug build
6-
./gradlew assembleDebug testDebugUnitTest
6+
./gradlew --no-daemon -parallel assembleDebug testDebugUnitTest

0 commit comments

Comments
 (0)