-
Notifications
You must be signed in to change notification settings - Fork 4
/
.travis.yml
82 lines (72 loc) · 2.97 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
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
- CODECOV_TOKEN="f89a63fe-9d43-4f05-8c7b-e0d78f0ebcfc"
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_app/gradlew
before_install:
- rm -rf $HOME/arduino_ide
- rm -rf $HOME/arduino_ide/libraries/TinyGPS
- rm -rf $HOME/arduino_ide/libraries/RFID-RC522
# 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"
- git clone https://github.com/mikalhart/TinyGPS.git $HOME/arduino_ide/libraries/TinyGPS
- git clone https://github.com/song940/RFID-RC522.git $HOME/arduino_ide/libraries/RFID-RC522
script:
# Build the Android app
- cd $TRAVIS_BUILD_DIR/android_app
- ./gradlew build --stacktrace
# Run the Android app's unit tests
- ./gradlew test --info
- ./gradlew build jacocoTestReport
- ./gradlew createDebugCoverageReport
- ./gradlew connectedCheck
# Run the Android app's instrumented tests
- ./gradlew connectedAndroidTest
# Build all .ino files for Arduino Mega
- cd $TRAVIS_BUILD_DIR/src/SafeSweeper
- build_platform mega2560
after_success:
# coverage report
- bash <(curl -s https://codecov.io/bash)