From 8caccd093b36163dd505fd045be0086c546a2b7d Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Tue, 13 Mar 2018 18:18:59 +0100 Subject: [PATCH 01/15] Require sudo in Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 158f89b4e..ddb13e758 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: android +sudo: required android: components: - platform-tools From d00aacaf9842d17a118a168733b65f07de145ccc Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Thu, 15 Mar 2018 19:01:37 +0100 Subject: [PATCH 02/15] Remove untested android API --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ddb13e758..cc0e8c22e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,6 @@ android: - tools - build-tools-27.0.3 - android-22 - - android-24 - - android-25 - extra-android-m2repository - sys-img-armeabi-v7a-android-22 From 55024aef22c80d26f7fc4d9d62c56fa4924fdf08 Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Thu, 15 Mar 2018 19:01:56 +0100 Subject: [PATCH 03/15] Fix file layout --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cc0e8c22e..c5518b223 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ android: - android-22 - extra-android-m2repository - sys-img-armeabi-v7a-android-22 - + jdk: - oraclejdk8 - openjdk7 From 8f054aa95c634205df4b7669b3e8c292e4e9b98b Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Thu, 15 Mar 2018 19:02:27 +0100 Subject: [PATCH 04/15] Remove caches --- .travis.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index c5518b223..182b468f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,14 +22,6 @@ matrix: - 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 From c9a81e5438e7801cd131fa4688eec4a1709e6430 Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Thu, 15 Mar 2018 19:03:19 +0100 Subject: [PATCH 05/15] Add no audio as a global variable --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 182b468f5..e9a1e1f4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,8 +14,11 @@ jdk: - openjdk7 env: - - BUILD_ANDROID=false - - BUILD_ANDROID=true + global: + - QEMU_AUDIO_DRV=none + matrix: + - BUILD_ANDROID=false + - BUILD_ANDROID=true matrix: exclude: From 8dfbe415c5b91324ca41b62e06516a75204239e1 Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Thu, 15 Mar 2018 19:04:33 +0100 Subject: [PATCH 06/15] Fix issue with new build tools --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e9a1e1f4d..26cbf8634 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,3 +41,4 @@ before_install: - if [ "$BUILD_ANDROID" = "false" ]; then cat /etc/hosts; fi install: true + - if [ "$BUILD_ANDROID" = "true" ]; then yes | sdkmanager "platforms;android-22"; fi From 2642c50b5a8f6e99f6e346854ff7db01fa3f3376 Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Thu, 15 Mar 2018 19:04:46 +0100 Subject: [PATCH 07/15] Remove unneeded install --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 26cbf8634..ede61eb5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,4 @@ before_install: - 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 From 4145c5d8b2627c6daf1131683759d82e682136ec Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Thu, 15 Mar 2018 19:05:11 +0100 Subject: [PATCH 08/15] Fix SSL issue with openjdk --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ede61eb5e..6eb92f5f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: android -sudo: required +sudo: true android: components: - platform-tools @@ -40,3 +40,11 @@ before_install: - 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 - 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 From d4306b749779c093019656a712c89424caf6e31d Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Thu, 15 Mar 2018 19:06:21 +0100 Subject: [PATCH 09/15] Add gradle.properties --- gradle.properties | 1 + 1 file changed, 1 insertion(+) create mode 100644 gradle.properties diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 000000000..8bd86f680 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M From 5a3502df62ff78cfdfce02ba3633a0b64980f3db Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Thu, 15 Mar 2018 19:07:43 +0100 Subject: [PATCH 10/15] Split tests in different scripts --- .travis.yml | 2 +- ci/run-android-tests.sh | 1 + ci/run-java-tests.sh | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 ci/run-android-tests.sh create mode 100644 ci/run-java-tests.sh diff --git a/.travis.yml b/.travis.yml index 6eb92f5f6..e6855c3c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ before_script: - 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: diff --git a/ci/run-android-tests.sh b/ci/run-android-tests.sh new file mode 100644 index 000000000..a90555fe2 --- /dev/null +++ b/ci/run-android-tests.sh @@ -0,0 +1 @@ +./gradlew connectedAndroidTest --info diff --git a/ci/run-java-tests.sh b/ci/run-java-tests.sh new file mode 100644 index 000000000..ee2477c04 --- /dev/null +++ b/ci/run-java-tests.sh @@ -0,0 +1,2 @@ +./gradlew java:testRealtimeSuite +./gradlew java:testRestSuite From 6e5622a236d7d93cef68f21bbef5d325fadf4dd1 Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Thu, 15 Mar 2018 19:08:10 +0100 Subject: [PATCH 11/15] Update obsolete flags --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e6855c3c8..65aeb5262 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,8 +26,8 @@ matrix: env: BUILD_ANDROID=true 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 echo no | android create avd -f -n test -t android-22 --abi armeabi-v7a; fi + - if [ "$BUILD_ANDROID" = "true" ]; then emulator -avd test -no-window & fi - if [ "$BUILD_ANDROID" = "true" ]; then android-wait-for-emulator; fi - if [ "$BUILD_ANDROID" = "true" ]; then adb shell input keyevent 82 & fi From 909e502ea2b4965257ee370462ee18324d2c5aaa Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Thu, 15 Mar 2018 19:08:57 +0100 Subject: [PATCH 12/15] Downgrade compileSdkVersion --- android/build.gradle | 2 +- ci/run-android-tests.sh | 0 ci/run-java-tests.sh | 2 ++ 3 files changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 ci/run-android-tests.sh mode change 100644 => 100755 ci/run-java-tests.sh diff --git a/android/build.gradle b/android/build.gradle index 4f04ae3a0..686ec9d55 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -15,7 +15,7 @@ ext { } android { - compileSdkVersion 27 + compileSdkVersion 22 buildToolsVersion '27.0.3' defaultConfig { diff --git a/ci/run-android-tests.sh b/ci/run-android-tests.sh old mode 100644 new mode 100755 diff --git a/ci/run-java-tests.sh b/ci/run-java-tests.sh old mode 100644 new mode 100755 index ee2477c04..eb73e83c8 --- a/ci/run-java-tests.sh +++ b/ci/run-java-tests.sh @@ -1,2 +1,4 @@ +rm -rf ./android/* + ./gradlew java:testRealtimeSuite ./gradlew java:testRestSuite From fe13cc67a0003b9b0cf022b37ee0b11dc3df82fe Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Fri, 16 Mar 2018 09:30:33 +0100 Subject: [PATCH 13/15] Unset ANDROID_HOME --- ci/run-java-tests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/run-java-tests.sh b/ci/run-java-tests.sh index eb73e83c8..c33011373 100755 --- a/ci/run-java-tests.sh +++ b/ci/run-java-tests.sh @@ -1,4 +1,5 @@ -rm -rf ./android/* +# We unset this, otherwise gradlew picks up settings also from the android "context", like here: https://travis-ci.org/ably/ably-java/jobs/353969106#L1980 +unset ANDROID_HOME ./gradlew java:testRealtimeSuite ./gradlew java:testRestSuite From 16d67a32f406517a42dd621201d164e317322482 Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Fri, 16 Mar 2018 10:11:55 +0100 Subject: [PATCH 14/15] Add Slack and email notifications --- .travis.yml | 13 +++++++++++++ ci/run-android-tests.sh | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 65aeb5262..09229e72f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,3 +48,16 @@ before_install: && 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 + +notifications: + slack: + rooms: + - secure: EK0WQz1q0PGExQmiTokVnRZTzrBEtULoF3Q05SsrYWlwBy+8r+kFuToWDY8914R2ReKEjozCgtuwx3cuEF01ITW8pnNER1ogQuGVAwz8x73fOndPdJxGRJaCAdy4S2uG4JmRqECtihNnNjlbkQZst4lNsVhtnQF32x7M6f4bLkg= + on_success: change + on_failure: always + email: + recipients: + - paddy@ably.io + - cesare@ably.io + on_success: change + on_failure: always diff --git a/ci/run-android-tests.sh b/ci/run-android-tests.sh index a90555fe2..0cebb4259 100755 --- a/ci/run-android-tests.sh +++ b/ci/run-android-tests.sh @@ -1 +1 @@ -./gradlew connectedAndroidTest --info +./gradlew connectedAndroidTest From 3a4325ee3e154a30f8fc6150c7e0a5383a180972 Mon Sep 17 00:00:00 2001 From: Cesare Rocchi Date: Fri, 16 Mar 2018 18:04:24 +0100 Subject: [PATCH 15/15] Build only master and develop branches --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 09229e72f..797fa23a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,3 +61,8 @@ notifications: - cesare@ably.io on_success: change on_failure: always + +branches: + only: + - master + - develop