Fixed CI stability: running android tests via emulator not graddle:co…

Summary:Running CI tests with emulator, not a graddle wrapper.
This should make things faster
Closes https://github.com/facebook/react-native/pull/6421

Differential Revision: D3042505

fb-gh-sync-id: 455264f90044c22ed3ec8cf9cb6d5edc2efedcdb
shipit-source-id: 455264f90044c22ed3ec8cf9cb6d5edc2efedcdb
This commit is contained in:
Konstantin Raev 2016-03-11 13:32:42 -08:00 committed by Facebook Github Bot 7
parent 299cd4cd01
commit 83095f95b5
2 changed files with 24 additions and 5 deletions

View File

@ -52,19 +52,19 @@ test:
# instrumentation tests # instrumentation tests
# compile native libs with Gradle script # compile native libs with Gradle script
- ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -PdisablePreDex -Pjobs=1: - ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1:
timeout: 360 timeout: 360
# build JS bundle for instrumentation tests # build JS bundle for instrumentation tests
- node local-cli/cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/assets/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js - node local-cli/cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/assets/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
# build test APK # build test APK
- buck/bin/buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=1 - buck/bin/buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=1
# run installed apk with tests # run installed apk with tests
- ./scripts/run-android-instrumentation-tests.sh com.facebook.react.tests - source scripts/circle-ci-android-setup.sh && retry3 ./scripts/run-android-instrumentation-tests.sh com.facebook.react.tests
# Deprecated: run tests with Gradle, we keep them for a while to compare performance # Deprecated: run tests with Gradle, we keep them for a while to compare performance
- ./gradlew :ReactAndroid:testDebugUnitTest -PdisablePreDex - ./gradlew :ReactAndroid:testDebugUnitTest
- ./gradlew :ReactAndroid:connectedAndroidTest -PdisablePreDex --stacktrace --info: - ./gradlew :ReactAndroid:installDebugAndroidTest
timeout: 360 - source scripts/circle-ci-android-setup.sh && retry3 ./scripts/run-android-instrumentation-tests.sh com.facebook.react.tests.gradle
# Publish to Sinopia, create a new app using 'react-native init' and check the packager starts # Publish to Sinopia, create a new app using 'react-native init' and check the packager starts
- ./scripts/e2e-test.sh --packager - ./scripts/e2e-test.sh --packager

View File

@ -20,3 +20,22 @@ function waitForAVD {
echo "emulator status=$bootanim" echo "emulator status=$bootanim"
done done
} }
function retry3 {
local n=1
local max=3
local delay=1
while true; do
"$@" && break || {
if [[ $n -lt $max ]]; then
((n++))
echo "Command failed. Attempt $n/$max:"
sleep $delay;
else
echo "The command has failed after $n attempts." >&2
return 1
fi
}
done
}