Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CircleCI] Move JS Bundle build step into Android #17709

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 26 additions & 56 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ aliases:
- &run-flow-checks
|
npm run flow -- check



- &filter-only-master-stable
branches:
only:
Expand Down Expand Up @@ -141,30 +140,34 @@ aliases:
buck build ReactAndroid/src/main/java/com/facebook/react
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
name: Wait for Android Virtual Device
command: source scripts/circle-ci-android-setup.sh && waitForAVD

- &check-js-bundle
name: Check for JavaScript Bundle
command: |
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
- &build-js-bundle
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

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

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

- &run-android-integration-tests
name: Build and Install Test APK
- &run-android-instrumentation-tests
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

- &collect-android-test-results
Expand Down Expand Up @@ -330,26 +333,6 @@ jobs:
echo "Skipping deploy."
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
test-android:
<<: *android_defaults
Expand All @@ -364,13 +347,8 @@ jobs:
- save-cache: *save-cache-android-packages

# Starting emulator in advance as it takes some time to boot.
- run:
name: Create Android Virtual Device
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
- run: *create-avd
- run: *launch-avd

# Keep configuring Android dependencies while AVD boots up
- run: *create-ndk-directory
Expand All @@ -382,12 +360,6 @@ jobs:
- run: *install-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/main/java/com/facebook/react
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
Expand All @@ -398,18 +370,19 @@ jobs:
- run: *build-android-app
- run: *compile-native-libs

# The JavaScript Bundle is built as part of the build-js-bundle workflow,
# and is required for instrumentation tests.
- attach_workspace:
at: ReactAndroid/src/androidTest/assets/
- run: *check-js-bundle
# The JavaScript Bundle is required for instrumentation tests.
- run: *install-node
- restore-cache: *restore-node-cache
- run: *install-node-dependencies
- save-cache: *save-node-cache
- run: *build-js-bundle

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

# Tests
- run: *run-android-unit-tests
- run: *run-android-integration-tests
- run: *run-android-instrumentation-tests

# post (always runs)
- run: *collect-android-test-results
Expand Down Expand Up @@ -474,11 +447,8 @@ workflows:
filters: *filter-ignore-gh-pages

# Test Android
- build-js-bundle:
filters: *filter-ignore-gh-pages
- test-android:
requires:
- build-js-bundle
filters: *filter-ignore-gh-pages

# Test iOS & tvOS
- test-objc-ios:
Expand Down