Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add/fix Travis tests #372

Merged
merged 15 commits into from
Mar 16, 2018
33 changes: 17 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
language: android
sudo: true
android:
components:
- platform-tools
- tools
- build-tools-27.0.3
- android-22
- android-24
- android-25
- extra-android-m2repository
- sys-img-armeabi-v7a-android-22

jdk:
- oraclejdk8
- openjdk7

env:
- BUILD_ANDROID=false
- BUILD_ANDROID=true
global:
- QEMU_AUDIO_DRV=none
matrix:
- BUILD_ANDROID=false
- BUILD_ANDROID=true

matrix:
exclude:
- jdk: openjdk7
env: BUILD_ANDROID=true

cache:
directories:
- $HOME/.gradle/caches/4.5
- $HOME/.gradle/caches/jars-1
- $HOME/.gradle/daemon
- $HOME/.gradle/native
- $HOME/.gradle/wrapper

before_script:
- if [ "$BUILD_ANDROID" = "true" ]; then echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a; fi
- if [ "$BUILD_ANDROID" = "true" ]; then emulator -avd test -no-skin -no-audio -no-window & fi
- if [ "$BUILD_ANDROID" = "true" ]; then android-wait-for-emulator; fi
- if [ "$BUILD_ANDROID" = "true" ]; then adb shell input keyevent 82 & fi

script: if [ "$BUILD_ANDROID" = "true" ]; then ./gradlew connectedAndroidTest; else ret=0; ./gradlew java:testRealtimeSuite || ret=1; ./gradlew java:testRestSuite || ret=1; exit $ret; fi
script: if [ "$BUILD_ANDROID" = "true" ]; then ./ci/run-android-tests.sh; else ./ci/run-java-tests.sh; fi

# Buffer overflow patch. Source: https://github.com/travis-ci/travis-ci/issues/5227#issuecomment-165135711
before_install:
- if [ "$BUILD_ANDROID" = "false" ]; then cat /etc/hosts; fi
- if [ "$BUILD_ANDROID" = "false" ]; then sudo hostname "$(hostname | cut -c1-63)"; fi
- if [ "$BUILD_ANDROID" = "false" ]; then sudo sed -i -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts; fi
- if [ "$BUILD_ANDROID" = "false" ]; then cat /etc/hosts; fi

install: true
- if [ "$BUILD_ANDROID" = "true" ]; then yes | sdkmanager "platforms;android-22"; fi
# taken from https://github.com/gretty-gradle-plugin/gretty/commit/f680ab388bf1f7a46f505ee2fe1a4a29e9a0a41e
- sudo apt-get -qq update
- sudo apt-get install -y zip curl locate libbcprov-java
- |
sudo ln -s /usr/share/java/bcprov.jar /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/bcprov.jar \
&& sudo awk -F . -v OFS=. 'BEGIN{n=2}/^security\.provider/ {split($3, posAndEquals, "=");$3=n++"="posAndEquals[2];print;next} 1' /etc/java-7-openjdk/security/java.security > /tmp/java.security \
&& sudo echo "security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider" >> /tmp/java.security \
&& sudo mv /tmp/java.security /etc/java-7-openjdk/security/java.security
1 change: 1 addition & 0 deletions ci/run-android-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./gradlew connectedAndroidTest --info
Copy link
Member

Choose a reason for hiding this comment

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

Do we still need the --info ?

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

2 changes: 2 additions & 0 deletions ci/run-java-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./gradlew java:testRealtimeSuite
./gradlew java:testRestSuite
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.gradle.jvmargs=-Xmx1536M
Copy link
Contributor Author

@funkyboy funkyboy Mar 15, 2018

Choose a reason for hiding this comment

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

Needed to avoid To run dex in process, the Gradle daemon needs a larger heap. message in Travis.