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 https://github.com/facebook/react-native/pull/17709

Differential Revision: D6775966

Pulled By: hramos

fbshipit-source-id: e50916c39060ed4e8ca880fcecc2830a51539bbd
This commit is contained in:
Héctor Ramos 2018-01-22 11:56:36 -08:00 committed by Facebook Github Bot
parent f50af7f8a4
commit 17bd6c8e84

View File

@ -89,7 +89,6 @@ aliases:
| |
npm run flow -- check npm run flow -- check
- &filter-only-master-stable - &filter-only-master-stable
branches: branches:
only: only:
@ -141,18 +140,22 @@ aliases:
buck build ReactAndroid/src/main/java/com/facebook/react buck build ReactAndroid/src/main/java/com/facebook/react
buck build ReactAndroid/src/main/java/com/facebook/react/shell buck build ReactAndroid/src/main/java/com/facebook/react/shell
- &create-avd
name: Create Android Virtual Device
command: source scripts/circle-ci-android-setup.sh && createAVD
- &launch-avd
name: Launch Android Virtual Device in Background
command: source scripts/circle-ci-android-setup.sh && launchAVD
background: true
- &wait-for-avd - &wait-for-avd
name: Wait for Android Virtual Device name: Wait for Android Virtual Device
command: source scripts/circle-ci-android-setup.sh && waitForAVD command: source scripts/circle-ci-android-setup.sh && waitForAVD
- &check-js-bundle - &build-js-bundle
name: Check for JavaScript Bundle name: Build JavaScript Bundle
command: | 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
if [[ ! -e ReactAndroid/src/androidTest/assets/AndroidTestBundle.js ]]; then
echo "JavaScript bundle missing, verify build-js-bundle step"; exit 1;
else
echo "JavaScript bundle found.";
fi
- &compile-native-libs - &compile-native-libs
name: Compile Native Libs for Unit and Integration Tests name: Compile Native Libs for Unit and Integration Tests
@ -160,11 +163,11 @@ aliases:
no_output_timeout: 6m no_output_timeout: 6m
- &run-android-unit-tests - &run-android-unit-tests
name: Unit Tests name: Run Unit Tests
command: buck test ReactAndroid/src/test/... --config build.threads=$BUILD_THREADS command: buck test ReactAndroid/src/test/... --config build.threads=$BUILD_THREADS
- &run-android-integration-tests - &run-android-instrumentation-tests
name: Build and Install Test APK name: Run Instrumentation Tests
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 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
- &collect-android-test-results - &collect-android-test-results
@ -330,26 +333,6 @@ jobs:
echo "Skipping deploy." echo "Skipping deploy."
fi fi
# Build JavaScript bundle for Android tests
build-js-bundle:
<<: *defaults
docker:
- image: circleci/node:8
steps:
- checkout
- restore-cache: *restore-node-cache
- run: *install-node-dependencies
- save-cache: *save-node-cache
- run:
name: Build JavaScript Bundle
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
- persist_to_workspace:
root: ReactAndroid/src/androidTest/assets/
paths:
- AndroidTestBundle.js
- store_artifacts:
path: ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
# Runs unit tests tests on Android # Runs unit tests tests on Android
test-android: test-android:
<<: *android_defaults <<: *android_defaults
@ -364,13 +347,8 @@ jobs:
- save-cache: *save-cache-android-packages - save-cache: *save-cache-android-packages
# Starting emulator in advance as it takes some time to boot. # Starting emulator in advance as it takes some time to boot.
- run: - run: *create-avd
name: Create Android Virtual Device - run: *launch-avd
command: source scripts/circle-ci-android-setup.sh && createAVD
- run:
name: Launch Android Virtual Device in Background
command: source scripts/circle-ci-android-setup.sh && launchAVD
background: true
# Keep configuring Android dependencies while AVD boots up # Keep configuring Android dependencies while AVD boots up
- run: *create-ndk-directory - run: *create-ndk-directory
@ -382,12 +360,6 @@ jobs:
- run: *install-buck - run: *install-buck
- save-cache: *save-cache-buck - save-cache: *save-cache-buck
- run: *install-node
- restore-cache: *restore-node-cache
- run: *install-node-dependencies
- save-cache: *save-node-cache
- run: buck fetch ReactAndroid/src/test/java/com/facebook/react/modules - run: buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react - run: buck fetch ReactAndroid/src/main/java/com/facebook/react
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react/shell - run: buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
@ -398,18 +370,19 @@ jobs:
- run: *build-android-app - run: *build-android-app
- run: *compile-native-libs - run: *compile-native-libs
# The JavaScript Bundle is built as part of the build-js-bundle workflow, # The JavaScript Bundle is required for instrumentation tests.
# and is required for instrumentation tests. - run: *install-node
- attach_workspace: - restore-cache: *restore-node-cache
at: ReactAndroid/src/androidTest/assets/ - run: *install-node-dependencies
- run: *check-js-bundle - save-cache: *save-node-cache
- run: *build-js-bundle
# Wait for AVD to finish booting before running tests # Wait for AVD to finish booting before running tests
- run: *wait-for-avd - run: *wait-for-avd
# Tests # Tests
- run: *run-android-unit-tests - run: *run-android-unit-tests
- run: *run-android-integration-tests - run: *run-android-instrumentation-tests
# post (always runs) # post (always runs)
- run: *collect-android-test-results - run: *collect-android-test-results
@ -474,11 +447,8 @@ workflows:
filters: *filter-ignore-gh-pages filters: *filter-ignore-gh-pages
# Test Android # Test Android
- build-js-bundle:
filters: *filter-ignore-gh-pages
- test-android: - test-android:
requires: filters: *filter-ignore-gh-pages
- build-js-bundle
# Test iOS & tvOS # Test iOS & tvOS
- test-objc-ios: - test-objc-ios: