Skip to content
This repository was archived by the owner on Mar 16, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 30 additions & 38 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,41 @@
language: android
jdk:
- oraclejdk8
sudo: required

language: android
jdk: oraclejdk8

services:
- docker

env:
- TEST_SUITE=unit
- TEST_SUITE=instrumentation

android:
components:
# Uncomment the lines below if you want to
# use the latest revision of Android SDK Tools
- tools
- platform-tools
- tools

# The BuildTools version used by your project
- build-tools-26.0.1

# The SDK version used to compile your project
- android-22
- android-26

# Additional components
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
- addon-google_apis-google-24

# Specify at least one system image,
# if you need to run emulator(s) during your tests
- sys-img-armeabi-v7a-android-22

- $(if [ $TEST_SUITE == "instrumentation" ]; then ./.travisAndroidComponents.sh; fi)

before_install:
- if [ $TEST_SUITE == "unit" ]; then
docker pull stefma-docker-hub.bintray.io/android-build-env:0.1-alpha;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how can we update this docker image?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is an open source project.
you can find it here: https://github.com/StefMa/AndroidBuildEnv

fi

before_script:

# First assemble the project before launching the emulator
- ./gradlew assemble

# List available emulators
- android list targets

# Emulator Management: Create, Start and Wait
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
- if [ $TEST_SUITE == "instrumentation" ]; then
./gradlew assemble;
echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a;
emulator -avd test -no-skin -no-audio -no-window &
android-wait-for-emulator;
adb shell input keyevent 82 &
fi

script:
- ./gradlew build jacocoTestReport assembleAndroidTest connectedCheck
- if [ $TEST_SUITE == "instrumentation" ]; then
./gradlew assembleAndroidTest connectedCheck;
fi
- if [ $TEST_SUITE == "unit" ]; then
docker run -i -v $PWD:/project -t stefma-docker-hub.bintray.io/android-build-env:0.1-alpha /bin/bash -c "./gradlew build jacocoTestReport";
fi

after_success:
- bash <(curl -s https://codecov.io/bash)
8 changes: 8 additions & 0 deletions .travisAndroidComponents.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# Read the BUILD_TOOL_VERSION and COMPILE_SDK_VERSION
BUILD_TOOLS_VERSION=$(cat build.gradle | grep "BUILD_TOOLS_VERSION*" | sed -e "s/^.*'\(.*\)'/\1/")
COMPILE_SDK_VERSION=$(cat build.gradle | grep "COMPILE_SDK_VERSION*" | sed -e "s/^.*= \(.*\)$/\1/")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we put this in the .travis.yml, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Unfortunately this isn't possible because of the limitations of the travis.yml file


# Echo every componnent we need to install and replace the BUILD_TOOLS_VERSION and COMPILE_SDK_VERSION
echo "tools,platform-tools,tools,build-tools-$BUILD_TOOLS_VERSION,android-22,android-$COMPILE_SDK_VERSION,extra-google-google_play_services,extra-google-m2repository,extra-android-m2repository,addon-google_apis-google-24,sys-img-armeabi-v7a-android-22"