Skip to content

Commit 17bd6c8

Browse files
hramosfacebook-github-bot
authored andcommitted
Move JS Bundle build step into Android
Summary: Current setup prevents Android signal from being obtained when JavaScript environment is affected. Proposed setup will configure Android build environment, surfacing any issues affecting Android even when a JavaScript bundle cannot be built. We cannot proceed with unit tests and instrumentation tests if JavaScript is affected, but we will at least still get some signal from running BUCK. Closes #17709 Differential Revision: D6775966 Pulled By: hramos fbshipit-source-id: e50916c39060ed4e8ca880fcecc2830a51539bbd
1 parent f50af7f commit 17bd6c8

File tree

1 file changed

+26
-56
lines changed

1 file changed

+26
-56
lines changed

.circleci/config.yml

+26-56
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ aliases:
8888
- &run-flow-checks
8989
|
9090
npm run flow -- check
91-
92-
91+
9392
- &filter-only-master-stable
9493
branches:
9594
only:
@@ -141,30 +140,34 @@ aliases:
141140
buck build ReactAndroid/src/main/java/com/facebook/react
142141
buck build ReactAndroid/src/main/java/com/facebook/react/shell
143142
143+
- &create-avd
144+
name: Create Android Virtual Device
145+
command: source scripts/circle-ci-android-setup.sh && createAVD
146+
147+
- &launch-avd
148+
name: Launch Android Virtual Device in Background
149+
command: source scripts/circle-ci-android-setup.sh && launchAVD
150+
background: true
151+
144152
- &wait-for-avd
145153
name: Wait for Android Virtual Device
146154
command: source scripts/circle-ci-android-setup.sh && waitForAVD
147155

148-
- &check-js-bundle
149-
name: Check for JavaScript Bundle
150-
command: |
151-
if [[ ! -e ReactAndroid/src/androidTest/assets/AndroidTestBundle.js ]]; then
152-
echo "JavaScript bundle missing, verify build-js-bundle step"; exit 1;
153-
else
154-
echo "JavaScript bundle found.";
155-
fi
156+
- &build-js-bundle
157+
name: Build JavaScript Bundle
158+
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
156159

157160
- &compile-native-libs
158161
name: Compile Native Libs for Unit and Integration Tests
159162
command: ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=$BUILD_THREADS -Pcom.android.build.threadPoolSize=1
160163
no_output_timeout: 6m
161164

162165
- &run-android-unit-tests
163-
name: Unit Tests
166+
name: Run Unit Tests
164167
command: buck test ReactAndroid/src/test/... --config build.threads=$BUILD_THREADS
165168

166-
- &run-android-integration-tests
167-
name: Build and Install Test APK
169+
- &run-android-instrumentation-tests
170+
name: Run Instrumentation Tests
168171
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
169172

170173
- &collect-android-test-results
@@ -330,26 +333,6 @@ jobs:
330333
echo "Skipping deploy."
331334
fi
332335
333-
# Build JavaScript bundle for Android tests
334-
build-js-bundle:
335-
<<: *defaults
336-
docker:
337-
- image: circleci/node:8
338-
steps:
339-
- checkout
340-
- restore-cache: *restore-node-cache
341-
- run: *install-node-dependencies
342-
- save-cache: *save-node-cache
343-
- run:
344-
name: Build JavaScript Bundle
345-
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
346-
- persist_to_workspace:
347-
root: ReactAndroid/src/androidTest/assets/
348-
paths:
349-
- AndroidTestBundle.js
350-
- store_artifacts:
351-
path: ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
352-
353336
# Runs unit tests tests on Android
354337
test-android:
355338
<<: *android_defaults
@@ -364,13 +347,8 @@ jobs:
364347
- save-cache: *save-cache-android-packages
365348

366349
# Starting emulator in advance as it takes some time to boot.
367-
- run:
368-
name: Create Android Virtual Device
369-
command: source scripts/circle-ci-android-setup.sh && createAVD
370-
- run:
371-
name: Launch Android Virtual Device in Background
372-
command: source scripts/circle-ci-android-setup.sh && launchAVD
373-
background: true
350+
- run: *create-avd
351+
- run: *launch-avd
374352

375353
# Keep configuring Android dependencies while AVD boots up
376354
- run: *create-ndk-directory
@@ -382,12 +360,6 @@ jobs:
382360
- run: *install-buck
383361
- save-cache: *save-cache-buck
384362

385-
- run: *install-node
386-
387-
- restore-cache: *restore-node-cache
388-
- run: *install-node-dependencies
389-
- save-cache: *save-node-cache
390-
391363
- run: buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
392364
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react
393365
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
@@ -398,18 +370,19 @@ jobs:
398370
- run: *build-android-app
399371
- run: *compile-native-libs
400372

401-
# The JavaScript Bundle is built as part of the build-js-bundle workflow,
402-
# and is required for instrumentation tests.
403-
- attach_workspace:
404-
at: ReactAndroid/src/androidTest/assets/
405-
- run: *check-js-bundle
373+
# The JavaScript Bundle is required for instrumentation tests.
374+
- run: *install-node
375+
- restore-cache: *restore-node-cache
376+
- run: *install-node-dependencies
377+
- save-cache: *save-node-cache
378+
- run: *build-js-bundle
406379

407380
# Wait for AVD to finish booting before running tests
408381
- run: *wait-for-avd
409382

410383
# Tests
411384
- run: *run-android-unit-tests
412-
- run: *run-android-integration-tests
385+
- run: *run-android-instrumentation-tests
413386

414387
# post (always runs)
415388
- run: *collect-android-test-results
@@ -474,11 +447,8 @@ workflows:
474447
filters: *filter-ignore-gh-pages
475448

476449
# Test Android
477-
- build-js-bundle:
478-
filters: *filter-ignore-gh-pages
479450
- test-android:
480-
requires:
481-
- build-js-bundle
451+
filters: *filter-ignore-gh-pages
482452

483453
# Test iOS & tvOS
484454
- test-objc-ios:

0 commit comments

Comments
 (0)