added emulator support to circle.ci

Summary: Closes https://github.com/facebook/react-native/pull/4911

Reviewed By: svcscm

Differential Revision: D2789142

Pulled By: androidtrunkagent

fb-gh-sync-id: 9fd9520c27fc9acb7b139de6843a71ca3f918249
This commit is contained in:
Konstantin Raev 2015-12-24 10:39:19 -08:00 committed by facebook-github-bot-7
parent c972cce405
commit 308612314e
3 changed files with 28 additions and 7 deletions

View File

@ -187,7 +187,7 @@ task buildReactNdkLib(dependsOn: [prepareJSC, prepareBoost, prepareDoubleConvers
"NDK_LIBS_OUT=$buildDir/react-ndk/all",
"THIRD_PARTY_NDK_DIR=$buildDir/third-party-ndk",
'-C', file('src/main/jni/react/jni').absolutePath,
'--jobs', Runtime.runtime.availableProcessors()
'--jobs', project.hasProperty("jobs") ? project.property("jobs") : Runtime.runtime.availableProcessors()
}
task cleanReactNdkLib(type: Exec) {

View File

@ -36,7 +36,8 @@ public class ReactAppTestActivity extends FragmentActivity implements
private static final String DEFAULT_BUNDLE_NAME = "AndroidTestBundle.js";
private static final int ROOT_VIEW_ID = 8675309;
private static final long IDLE_TIMEOUT_MS = 15000;
// we need a bigger timeout for CI builds because they run on a slow emulator
private static final long IDLE_TIMEOUT_MS = 60000;
private CountDownLatch mLayoutEvent = new CountDownLatch(1);
private @Nullable ReactBridgeIdleSignaler mBridgeIdleSignaler;

View File

@ -1,16 +1,36 @@
machine:
node:
version: 5.1.0
environment:
PATH: "~/$CIRCLE_PROJECT_REPONAME/gradle-2.9/bin:$PATH"
TERM: "dumb"
ADB_INSTALL_TIMEOUT: "10"
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx512m -XX:+HeapDumpOnOutOfMemoryError"'
dependencies:
pre:
- npm install -g npm@3.2
- wget "https://services.gradle.org/distributions/gradle-2.9-bin.zip"; unzip gradle-2.9-bin.zip
test:
pre:
# starting emulator in advance because it takes very long to boot
# the side effect is that we loose 1GB of RAM for all the following commands
# if builds are running out of memory move the emulator start right before `wait-for-boot`
- emulator -avd circleci-android22 -no-audio -no-window:
background: true
parallel: true
override:
# gradle is flaky in CI envs, found a solution here http://stackoverflow.com/questions/28409608/gradle-assembledebug-and-predexdebug-fail-with-circleci
- TERM=dumb ./gradlew testDebugUnitTest -PpreDexEnable=false -Pcom.android.build.threadPoolSize=1 -Dorg.gradle.parallel=false -Dorg.gradle.jvmargs="-Xms512m -Xmx512m" -Dorg.gradle.daemon=false
# build JS bundle
# build ndkreactlib first because it consumes memory and downloads stuff
- ./gradlew :ReactAndroid:buildReactNdkLib -PdisablePreDex -Pjobs=1
# unit tests
- ./gradlew :ReactAndroid:testDebugUnitTest -PdisablePreDex
# 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
# run instrumentation tests on device
- TERM=dumb ./gradlew connectedCheck
- circle-android wait-for-boot
- sleep 5
# unlock the emulator screen
- adb shell input keyevent 82
- sleep 5
# run tests on the emulator
- ./gradlew :ReactAndroid:connectedAndroidTest -PdisablePreDex --stacktrace