@@ -112,7 +112,8 @@ aliases:
112112 sudo apt-get install -y nodejs
113113
114114 - &create-ndk-directory
115- |
115+ name : Create Android NDK Directory
116+ command : |
116117 if [[ ! -e /opt/ndk ]]; then
117118 sudo mkdir /opt/ndk
118119 fi
@@ -121,16 +122,18 @@ aliases:
121122 # CircleCI does not support interpolating env variables in the environment
122123 # https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables
123124 - &configure-android-path
124- |
125+ name : Configure Environment Variables
126+ command : |
125127 echo 'export PATH=${ANDROID_NDK}:~/react-native/gradle-2.9/bin:~/buck/bin:$PATH' >> $BASH_ENV
126128 source $BASH_ENV
127129
128130 - &install-android-packages
129131 |
130132 source scripts/circle-ci-android-setup.sh && getAndroidSDK
131133
132- - &install-build-dependencies
133- |
134+ - &install-android-build-dependencies
135+ name : Install Android Build Dependencies
136+ command : |
134137 sudo apt-get update -y
135138 sudo apt-get install ant autoconf automake g++ gcc libqt5widgets5 lib32z1 lib32stdc++6 make maven python-dev python3-dev qml-module-qtquick-controls qtdeclarative5-dev file -y
136139
@@ -171,7 +174,6 @@ aliases:
171174 - &build-js-bundle
172175 name : Build JavaScript Bundle
173176 command : node local-cli/cli.js bundle --max-workers 2 --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
174- when : always
175177
176178 - &compile-native-libs
177179 name : Compile Native Libs for Unit and Integration Tests
@@ -184,7 +186,11 @@ aliases:
184186
185187 - &run-android-instrumentation-tests
186188 name : Run Instrumentation Tests
187- command : source scripts/circle-ci-android-setup.sh && NO_BUCKD=1 retry3 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=$BUILD_THREADS
189+ command : |
190+ if [[ ! -e ReactAndroid/src/androidTest/assets/AndroidTestBundle.js ]]; then
191+ echo "JavaScript bundle missing, cannot run instrumentation tests. Verify build-js-bundle step completed successfully."; exit 1;
192+ fi
193+ source scripts/circle-ci-android-setup.sh && NO_BUCKD=1 retry3 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=$BUILD_THREADS
188194
189195 - &collect-android-test-results
190196 name : Collect Test Results
@@ -254,6 +260,8 @@ jobs:
254260 path : ~/reports/junit
255261 - store_artifacts :
256262 path : ~/reports/junit
263+ - store_artifacts :
264+ path : ~/react-native/yarn.lock
257265
258266 # Runs JavaScript tests on Node 8
259267 js-node-8 :
@@ -387,7 +395,7 @@ jobs:
387395
388396 # Configure Android dependencies
389397 - run : *configure-android-path
390- - run : *install-build-dependencies
398+ - run : *install-android- build-dependencies
391399 - restore-cache : *restore-cache-android-packages
392400 - run : *install-android-packages
393401 - save-cache : *save-cache-android-packages
@@ -430,9 +438,9 @@ jobs:
430438 - checkout
431439 - run : *setup-artifacts
432440
433- # Configure Android dependencies
441+ # Configure Android SDK and related dependencies
434442 - run : *configure-android-path
435- - run : *install-build-dependencies
443+ - run : *install-android- build-dependencies
436444 - restore-cache : *restore-cache-android-packages
437445 - run : *install-android-packages
438446 - save-cache : *save-cache-android-packages
@@ -442,11 +450,8 @@ jobs:
442450 - run : *launch-avd
443451
444452 # Keep configuring Android dependencies while AVD boots up
445- - run : *create-ndk-directory
446- - restore-cache : *restore-cache-ndk
447- - run : *install-ndk
448- - save-cache : *save-cache-ndk
449453
454+ # Fetch dependencies using BUCK
450455 - restore-cache : *restore-cache-buck
451456 - run : *install-buck
452457 - save-cache : *save-cache-buck
@@ -458,10 +463,17 @@ jobs:
458463 - run : buck fetch ReactAndroid/src/androidTest/...
459464 - run : ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog :ReactAndroid:downloadJSCHeaders
460465
466+ # Install Android NDK
467+ - run : *create-ndk-directory
468+ - restore-cache : *restore-cache-ndk
469+ - run : *install-ndk
470+ - save-cache : *save-cache-ndk
471+
472+ # Build and compile
461473 - run : *build-android-app
462474 - run : *compile-native-libs
463475
464- # The JavaScript Bundle is required for instrumentation tests.
476+ # Build JavaScript Bundle for instrumentation tests
465477 - run : *install-node
466478 - run : *install-yarn
467479 - restore-cache : *restore-yarn-cache
@@ -472,7 +484,7 @@ jobs:
472484 # Wait for AVD to finish booting before running tests
473485 - run : *wait-for-avd
474486
475- # Tests
487+ # Test Suite
476488 - run : *run-android-unit-tests
477489 - run : *run-android-instrumentation-tests
478490
@@ -568,4 +580,4 @@ workflows:
568580 - hold
569581
570582 - analyze-pull-request :
571- filters : *filter-ignore-master-stable
583+ filters : *filter-ignore-master-stable
0 commit comments