forked from openedx-unsupported/edx-app-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
78 lines (67 loc) · 2.65 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
language: android
jdk: oraclejdk8
sudo: required
dist: precise # For 7.5GB of memory since the emulator requires a big chunk.
env:
matrix:
- ANDROID_TARGET=android-23
global:
- ADB_INSTALL_TIMEOUT=12
android:
components:
# use the latest revision of Android SDK Tools
- platform-tools
- tools
# The BuildTools version used
- build-tools-23.0.3
# The SDK version used to compile the project
- android-23
# Additional components
- extra-google-m2repository
- extra-android-m2repository
notifications:
email: true
before_script:
- git fetch --tags
- git fetch --unshallow || true
- export DESCRIBE=$(git describe)
- export PR=https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo `curl -s $PR | jq -r .head.ref`; fi)
- echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$PR, BRANCH=$BRANCH, DESCRIBE=$DESCRIBE"
- chmod +x gradlew
# ARM architecture is used instead of x86 (which is 10x faster) of the lack of support from CI due
# to complications of creating a virtual machine within a virtual machine. This may be solved
# eventually and would significantly speed some things up.
# Create the AVD for screenshot tests
- android create avd --force --name screenshotDevice --target android-21 --abi armeabi-v7a --device "Nexus 4" --skin 768x1280 --sdcard 250M
- echo "runtime.scalefactor=auto" >> $HOME/.android/avd/screenshotDevice.avd/config.ini
# Boot up the emulator in the background
- emulator -avd screenshotDevice -no-audio -no-window &
script:
# --debug or --info info flag can be suffixed to following command for more detailed logs of tests
# It comes in handy to see stacktraces from test failures, which otherwise aren't printed
# P.S. --debug flag prints too many logs that are mostly not needed, which make it exceed the
# 4mb limit enforced by travis (so use it with caution)
- ./gradlew lintProdDebug
- ./gradlew copyLintBuildArtifacts
- ./gradlew testProdDebugUnitTestCoverage
- ./gradlew copyUnitTestBuildArtifacts
- android-wait-for-emulator
- adb shell input keyevent 82 &
# Run screenshot tests and compare them against screenshots in PR
- ./gradlew verifyMode screenshotTests -PdisablePreDex
after_script:
- curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash
- ~/bin/artifacts upload artifacts
branches:
only:
- master
# Enable caching to speed up the build
cache:
directories:
- $HOME/.gradle
before_install:
- pip install --user codecov
- pip install --user pillow # For screenshot tests
after_success:
- codecov