From 2c0a92aa63e07db89311ad867b5771708b31347a Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Fri, 22 Jan 2016 12:15:38 -0800 Subject: [PATCH] ci script --- scripts/test.sh | 35 +++++++++++++++++++++++++++++-- tests/react-test-app/package.json | 1 + 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/scripts/test.sh b/scripts/test.sh index 12b86771..b50ab0cf 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -20,10 +20,10 @@ PACKAGER_OUT="packager_out.txt" function start_packager() { rm -f $PACKAGER_OUT - sh ./node_modules/react-native/packager/packager.sh | tee packager_out.txt & + sh ./node_modules/react-native/packager/packager.sh | tee $PACKAGER_OUT & while :; do - if grep -Fxq "React packager ready." packager_out.txt + if grep -Fxq "React packager ready." $PACKAGER_OUT then break else @@ -68,6 +68,37 @@ elif [ "$TARGET" = "react-example" ]; then xcodebuild -scheme ReactExample -configuration "$CONFIGURATION" -sdk iphonesimulator build $DESTINATION popd +elif [ "$TARGET" = "react-tests-android" ]; then + pushd react-native/android + ./gradlew installarchives + popd + + pushd tests/react-test-app + + if [ -d ~/Applications/Google\ Chrome.app ]; then + open ~/Applications/Google\ Chrome.app + fi + + npm install + start_packager + + sh run-android.sh + + LOGCAT_OUT="logcat_out.txt" + rm -f $LOGCAT_OUT + adb logcat | tee $LOGCAT_OUT & + while :; + do + if grep -q "FILE WRITTEN!!" $LOGCAT_OUT + then + break + else + echo "Waiting for tests." + sleep 2 + fi + done + + adb pull /data/data/com.demo/files/tests.xml . else echo "Invalid target '${TARGET}'" fi diff --git a/tests/react-test-app/package.json b/tests/react-test-app/package.json index 7161122b..fd25ac53 100644 --- a/tests/react-test-app/package.json +++ b/tests/react-test-app/package.json @@ -8,6 +8,7 @@ "dependencies": { "react-native": "^0.18.0-rc", "react-native-fs": "^1.1.0", + "xmlbuilder": "^4.2.1", "realm": "file:../..", "realm-tests": "file:../lib" }