Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
Update TravisCI (#2634)
Browse files Browse the repository at this point in the history
* Update travisCI

* Update travisCI

* Update travisCI of Android

* Update travisCI for performance.

* Update travisCI

* Update danger

* Speed up travisCI

* Update travis

* Update travis

* Update travis

* Update Log

* Update switch case

* Update android

* Update gradle

* Update travisCI

* Update travisCI for good

* Update travis

* Update travis

* Add repository back

* Update for android

* Update travis

* Remove tools

* Remove platform tools

* Remove google repo

* Add google back for travisCI

* Update build.gradle

* Update test

* Update travis

* Add ruby for good

* Update travis

* Update travis

* Update travis

* Update for travis

* Remove unrelated import

* Update Travsi

* Update travis

* Remove rvm

* Update danger for good.
  • Loading branch information
YorkShen authored and lucky-chen committed Jul 5, 2019
1 parent d8bbe74 commit fdec2ee
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 79 deletions.
125 changes: 75 additions & 50 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
os: linux
language: node_js
node_js: 7.6
rvm: 2.0.0
matrix:
fast_finish: true
include:
- os: linux
env: TEST_SUITE=android
- env: TEST_SUITE=danger
- env: TEST_SUITE=jsfm
- env: TEST_SUITE=android ABI=armeabi-v7a
language: android
dist: trusty
jdk: oraclejdk8
android:
components:
- android-26
- extra-android-m2repository
- env: TEST_SUITE=android ABI=arm64-v8a
language: android
dist: trusty
jdk: oraclejdk8
android:
components:
- android-26
- extra-android-m2repository
- env: TEST_SUITE=android ABI=x86
language: android
dist: trusty
jdk: oraclejdk8
android:
components:
- platform-tools
- tools
- build-tools-26.0.3
- android-26
- extra-google-m2repository
- extra-android-m2repository
- sys-img-x86-android-26
- os: linux
env: TEST_SUITE=jsfm
- os: osx
env: TEST_SUITE=danger
cache:
directories:
- npm
Expand All @@ -34,47 +42,64 @@ before_cache:
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
install:
- |
if [[ $TEST_SUITE = "android" ]]; then
curl -o- https://github.com/raw/creationix/nvm/v0.33.2/install.sh | bash
nvm install 7.0
npm install
echo y | sdkmanager "cmake;3.6.4111459"
if find "${HOME}/android-ndk-r18b" -mindepth 1 | read; then
echo "dir not empty"
else
echo "dir empty"
rmdir "${HOME}/android-ndk-r18b"
fi
case $TEST_SUITE in
"android")
curl -o- https://github.com/raw/nvm-sh/nvm/v0.34.0/install.sh | bash
nvm install 7.6
npm install
echo y | sdkmanager "cmake;3.6.4111459"
if find "${HOME}/android-ndk-r18b" -mindepth 1 | read; then
echo "NDK cache hit"
else
echo "NDK cache missed"
rmdir "${HOME}/android-ndk-r18b"
fi
if [[ ! -d "${HOME}/android-ndk-r18b" ]]; then
wget https://dl.google.com/android/repository/android-ndk-r18b-linux-x86_64.zip
unzip android-ndk-r18b-linux-x86_64.zip -d $HOME
fi
export ANDROID_NDK_HOME=$HOME/android-ndk-r18b
export PATH=$PATH:$ANDROID_NDK_HOME
echo "ndk.dir=$ANDROID_NDK_HOME" > android/local.properties
fi
- |
if [[ $TEST_SUITE = "jsfm" ]]; then
npm install
fi
- |
if [[ $TEST_SUITE = "danger" ]]; then
npm install
fi
if [[ ! -d "${HOME}/android-ndk-r18b" ]]; then
wget https://dl.google.com/android/repository/android-ndk-r18b-linux-x86_64.zip
unzip android-ndk-r18b-linux-x86_64.zip -d $HOME
fi
export ANDROID_NDK_HOME=$HOME/android-ndk-r18b
export PATH=$PATH:$ANDROID_NDK_HOME
echo "ndk.dir=$ANDROID_NDK_HOME" > android/local.properties
;;
"jsfm" | "danger" )
npm install
;;
esac
script:
- |
if [[ $TEST_SUITE = "android" ]]; then
npm run danger -- run --dangerfile ./dangerfile-android.js
fi
- |
if [[ $TEST_SUITE = "jsfm" ]]; then
npm run danger -- run --dangerfile ./dangerfile-jsfm.js
fi
- |
if [[ $TEST_SUITE = "danger" ]]; then
npm run danger -- run --dangerfile ./dangerfile.js
fi
case $TEST_SUITE in
"android")
case $ABI in
"armeabi-v7a" )
GRADLE_ABI="-PsupportArmeabi-v7a=true -PsupportArm64-v8a=false -PsupportX86=false"
;;
"arm64-v8a" )
GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=true -PsupportX86=false"
;;
"x86" )
GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=false -PsupportX86=true"
;;
"*" )
GRADLE_ABI=""
;;
esac
hasAndroidFile=$(npm run danger -- run --dangerfile ./dangerfile-android.js)
echo "The value of hasAndroidFile is ${hasAndroidFile}"
if [[ "$hasAndroidFile" =~ "hasAndroidFile" ]]; then
cd android
./gradlew clean install ${GRADLE_ABI} --info
fi
;;
"jsfm" )
npm run danger -- run --dangerfile ./dangerfile-jsfm.js
;;
"danger" )
npm run danger -- run --dangerfile ./dangerfile.js
;;
esac
notifications:
webhooks:
on_pull_requests: false
Expand Down
5 changes: 0 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ buildscript {
}
}

plugins {
id "de.undercouch.download" version "3.2.0"
// id "com.github.dcendents.android-maven" version "1.5"
}

subprojects {
if(project.hasProperty('external_script')){
for(item in external_script.split()) {
Expand Down
12 changes: 11 additions & 1 deletion android/sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,17 @@ android {
versionCode 1
versionName project.version
ndk {
abiFilters "arm64-v8a", "armeabi-v7a", "x86"
if(!project.hasProperty('supportArmeabi-v7a') || "false" != project.getProperty('supportArmeabi-v7a')){
abiFilters 'arm64-v8a'
}

if(!project.hasProperty('supportArm64-v8a') || "false" != project.getProperty('supportArm64-v8a')){
abiFilters 'arm64-v8a'
}

if(!project.hasProperty('supportX86') || "false" != project.getProperty('supportX86')){
abiFilters 'x86'
}
}
externalNativeBuild {
cmake {
Expand Down
31 changes: 8 additions & 23 deletions dangerfile-android.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
* under the License.
*/
import { schedule, danger, fail, warn, message, markdown } from "danger";
import fs from "fs";
import path from 'path';
import GitHubApi from 'github';
import parseDiff from 'parse-diff';
import shell from "shelljs";

const type_unknown = 0;
const type_ios_sdk = 1;
Expand All @@ -31,6 +26,7 @@ const type_android_test = 4;
const type_jsfm = 5;
const type_jsfm_test = 6;
const type_ui_test = 8;
const type_weex_core =9

const getFileType = file => {
if (file.match(/WeexSDK\/Sources\/.+\.(m|h|mm)/)) {
Expand All @@ -41,22 +37,23 @@ const getFileType = file => {
return type_android_test;
} else if (file.match(/android\/sdk\/src\/main\/java\/.+\.java/)) {
return type_android_sdk;
} else if (
file.match(/html5\/(shared|frameworks|render|runtime|services)\/.+\.js/)
) {
} else if (file.match(/html5\/(shared|frameworks|render|runtime|services)\/.+\.js/)) {
return type_jsfm;
} else if (file.match(/html5\/test\/.+\.js/)) {
return type_jsfm_test;
} else if(file.match(/test\/scripts\/.+\.js/) || file.match(/test\/pages\/.+\.vue/)){
return type_ui_test
}else{
} else if(file.match(/weex_core\//)){
return type_weex_core
}
else{
return type_unknown
}
}

function checkAndroidFile(file){
var type = getFileType(file);
return true
return type == type_android_test || type == type_android_sdk || type == type_jsfm || type == type_weex_core;
}

var hasAndroidFile = false;
Expand Down Expand Up @@ -88,18 +85,6 @@ if (!hasAndroidFile && danger.git.deleted_files) {
return f;
});
}
console.log('-----------------------------hasAndroidFile-----------------------------:'+hasAndroidFile);
if(hasAndroidFile){
var runTryBuildCmd='source ~/.bash_profile; '
+'cd android; '
+'./gradlew clean install --info'
var runSuccess = shell.exec(runTryBuildCmd,{ async: false, timeout: 60 * 60 * 1000, maxBuffer: 200 * 1024 * 1024 }).code == 0;
if(!runSuccess){
fail("Failed to run assembleDebug task for android.");
}
}else{
console.log('No android file has been changed.');
message('No android file has been changed.')
console.log('hasAndroidFiled');
}

message('android build verification finished.')

0 comments on commit fdec2ee

Please sign in to comment.