Skip to content

Commit 25389c1

Browse files
authored
Merge pull request firebase#153 from samtstern/master
Make travis much faster
2 parents d98869d + 86c8d84 commit 25389c1

File tree

2 files changed

+46
-30
lines changed

2 files changed

+46
-30
lines changed

.travis.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,27 @@ android:
1616
- 'android-sdk-preview-license-52d11cd2'
1717
- 'android-sdk-license-.+'
1818
- 'google-gdk-license-.+'
19+
20+
before_cache:
21+
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
22+
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
23+
cache:
24+
directories:
25+
- $HOME/.gradle/caches/
26+
- $HOME/.gradle/wrapper/
27+
28+
env:
29+
- SAMPLE=admob
30+
- SAMPLE=analytics
31+
- SAMPLE=app-indexing
32+
- SAMPLE=auth
33+
- SAMPLE=config
34+
- SAMPLE=crash
35+
- SAMPLE=database
36+
- SAMPLE=dynamiclinks
37+
- SAMPLE=invites
38+
- SAMPLE=messaging
39+
- SAMPLE=storage
40+
1941
script:
2042
- ./build.sh

build.sh

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,37 @@
33
# Exit on error
44
set -e
55

6-
# List of all samples
7-
samples=( admob analytics app-indexing auth config crash database dynamiclinks invites messaging storage )
8-
96
# Limit memory usage
107
OPTS='-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
118

129
# Work off travis
13-
if [[ -v TRAVIS_PULL_REQUEST ]]; then
10+
if [[ ! -z TRAVIS_PULL_REQUEST ]]; then
1411
echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST"
1512
else
1613
echo "TRAVIS_PULL_REQUEST: unset, setting to false"
1714
TRAVIS_PULL_REQUEST=false
1815
fi
1916

20-
for sample in "${samples[@]}"
21-
do
22-
echo "Building ${sample}"
23-
24-
# Go to sample directory
25-
cd $sample
26-
27-
# Copy mock google-services file if necessary
28-
if [ ! -f ./app/google-services.json ]; then
29-
echo "Using mock google-services.json"
30-
cp ../mock-google-services.json ./app/google-services.json
31-
fi
32-
33-
# Build
34-
if [ $TRAVIS_PULL_REQUEST = false ] ; then
35-
# For a merged commit, build all configurations.
36-
GRADLE_OPTS=$OPTS ./gradlew clean build
37-
else
38-
# On a pull request, just build debug which is much faster and catches
39-
# obvious errors.
40-
GRADLE_OPTS=$OPTS ./gradlew clean :app:assembleDebug
41-
fi
42-
43-
# Back to parent directory.
44-
cd -
45-
done
17+
echo "Building ${SAMPLE}"
18+
19+
# Go to sample directory
20+
cd $SAMPLE
21+
22+
# Copy mock google-services file if necessary
23+
if [ ! -f ./app/google-services.json ]; then
24+
echo "Using mock google-services.json"
25+
cp ../mock-google-services.json ./app/google-services.json
26+
fi
27+
28+
# Build
29+
if [ $TRAVIS_PULL_REQUEST = false ] ; then
30+
# For a merged commit, build all configurations.
31+
GRADLE_OPTS=$OPTS ./gradlew clean build
32+
else
33+
# On a pull request, just build debug which is much faster and catches
34+
# obvious errors.
35+
GRADLE_OPTS=$OPTS ./gradlew clean :app:assembleDebug
36+
fi
37+
38+
# Back to parent directory.
39+
cd -

0 commit comments

Comments
 (0)