-
Notifications
You must be signed in to change notification settings - Fork 4
/
.travis.yml
77 lines (68 loc) · 2.91 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
language: android
jdk: oraclejdk8
# Set environment variables
env:
global:
# Set timeout for the Android emulator to come online
- ADB_INSTALL_TIMEOUT=10
# Set the minimum Android API to support
# Note: Not all of them work well with Travis
- ANDROID_TARGET=android-22
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
cache:
directories:
# Cache all dirs under .gradle folder
- $HOME/.gradle/daemon # Cache daemon logs
- $HOME/.gradle/native # Cache library downloaded from the gradle dependency
- $HOME/.gradle/wrapper # Cache the gradle
# Try to reuse previously downloaded Arduino resources
- $HOME/arduino_ide # Cache Arduino IDE
- $HOME/.arduino15/packages/ # Cache Arduino IDE packages
android:
components:
- tools # to get the new `repository-11.xml`
- tools # see https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943)
- platform-tools
- build-tools-28.0.3
- $ANDROID_TARGET # Our minimum Android version
- sys-img-armeabi-v7a-$ANDROID_TARGET
- extra-android-m2repository
- extra-google-m2repository
before_script:
# Launch Android emulator to run the instrumented tests
- android list targets
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi armeabi-v7a # Create AVD for given api
- emulator -avd test -no-audio -no-window & # Start emulator
- android-wait-for-emulator
- adb devices # Display list of devices
- adb shell input keyevent 82 &
# Set `gradlew` as executable
- chmod +x $TRAVIS_BUILD_DIR/android/gradlew
- cp $TRAVIS_BUILD_DIR/android/gradle.properties.no.git $TRAVIS_BUILD_DIR/android/gradle.properties
- sed -i "s/myKey/$GoolgeAPIKey/g" $TRAVIS_BUILD_DIR/android/gradle.properties
# - wget https://github.com/mikalhart/TinyGPSPlus/archive/v1.0.2.tar.gz
# - tar -xzvf v1.0.2.tar.gz
# - export PATH=$PATH:$PWD/TinyGPSPlus/src/
# - mv TinyGPSPlus-1.0.2/TinyGPSPlus/
before_install:
# Install Android 9 SDK and accept its user agreement
- echo yes | sdkmanager "platforms;android-28"
# Install Travis CI configuration for Arduino sketches
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
install:
# Install Smartcar shield library (used by our sketch)
- arduino --install-library "Smartcar shield"
- arduino --install-library "NewPing"
- git clone https://github.com/mikalhart/TinyGPSPlus.git $HOME/arduino_ide/libraries/TinyGPSPlus || true
script:
# Build the Android app
- cd $TRAVIS_BUILD_DIR/android
- ./gradlew build --stacktrace
# Run the Android app's unit tests
- ./gradlew test --info
# Run the Android app's instrumented tests
- ./gradlew connectedAndroidTest
# Build all .ino files for Arduino Mega
- cd $TRAVIS_BUILD_DIR/arduino
- build_platform mega2560