From 1ff1e573f1dd46ee987bb5a444c85c46c7abf34a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= Date: Fri, 9 Mar 2018 17:06:51 -0800 Subject: [PATCH] Add existing Android checks to Circle. Summary: Moving towards reusing existing scripts to ensure local and CI tests are kept in sync. Closes https://github.com/facebook/react-native/pull/18307 Differential Revision: D7222664 Pulled By: hramos fbshipit-source-id: ecce91e32159c55b19c29eab69a6754642f02236 --- .circleci/config.yml | 22 +++++++++++++++++----- scripts/validate-android-test-env.sh | 19 +++++++++++++++---- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e061ce1b4..100bc1276 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,8 +89,8 @@ aliases: # Dependency Management - &install-ndk - | - source scripts/circle-ci-android-setup.sh && getAndroidNDK + name: Install Android NDK + command: source scripts/circle-ci-android-setup.sh && getAndroidNDK - &yarn | @@ -136,8 +136,8 @@ aliases: source $BASH_ENV - &install-android-packages - | - source scripts/circle-ci-android-setup.sh && getAndroidSDK + name: Install Android SDK Packages + command: source scripts/circle-ci-android-setup.sh && getAndroidSDK - &install-android-build-dependencies name: Install Android Build Dependencies @@ -145,6 +145,14 @@ aliases: sudo apt-get update -y 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 + - &validate-android-sdk + name: Validate Android SDK Install + command: ./scripts/validate-android-sdk.sh + + - &validate-android-test-env + name: Validate Android Test Environment + command: ./scripts/validate-android-test-env.sh + # Test Definitions - &run-js-tests name: JavaScript Test Suite @@ -444,6 +452,8 @@ jobs: - run: *install-android-packages - save-cache: *save-cache-android-packages + - run: *validate-android-sdk + # Starting emulator in advance as it takes some time to boot. - run: *create-avd - run: *launch-avd @@ -461,6 +471,8 @@ jobs: - run: *install-buck - save-cache: *save-cache-buck + - run: *validate-android-test-env + - 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 @@ -478,7 +490,7 @@ jobs: # Wait for AVD to finish booting before running tests - run: *wait-for-avd - + # Test Suite - run: *run-android-unit-tests - run: *run-android-instrumentation-tests diff --git a/scripts/validate-android-test-env.sh b/scripts/validate-android-test-env.sh index 8b428e76f..0461de767 100755 --- a/scripts/validate-android-test-env.sh +++ b/scripts/validate-android-test-env.sh @@ -14,18 +14,23 @@ if [ -z "$(which buck)" ]; then exit 1 fi -if [ -z "$(buck --version)" ]; then +BUCK_ACTUAL_COMMIT=$(buck --version) +BUCK_SUGGESTED_V="v2018.02.16.01" +BUCK_SUGGESTED_COMMIT="d743d2d0229852ce7c029ec257532d8916f6b2b7" +BUCK_SUGGESTED_COMMIT_FB="b9b76a3a5a086eb440a26d1db9b0731875975099" + +if [ -z "$BUCK_ACTUAL_COMMIT" ]; then echo "Your Buck install is broken." if [ -d "/opt/facebook" ]; then - SUGGESTED="b9b76a3a5a086eb440a26d1db9b0731875975099" + BUCK_SUGGESTED_COMMIT_FB="b9b76a3a5a086eb440a26d1db9b0731875975099" echo "FB laptops ship with a Buck config that is not compatible with open " echo "source. FB Buck requires the environment to set a buck version, but " echo "the open source version of Buck forbids that." echo echo "You can try setting:" echo - echo "export BUCKVERSION=${SUGGESTED}" + echo "export BUCKVERSION=${BUCK_SUGGESTED_COMMIT_FB}" echo echo "in your .bashrc or .bash_profile to fix this." echo @@ -33,12 +38,18 @@ if [ -z "$(buck --version)" ]; then echo "your machine, you can just scope it to a single script, for example" echo "by running something like:" echo - echo "BUCKVERSION=${SUGGESTED} $0" + echo "BUCKVERSION=${BUCK_SUGGESTED_COMMIT_FB} $0" echo else echo "I don't know what's wrong, but calling 'buck --version' should work." fi exit 1 +else + if [ "$BUCK_ACTUAL_COMMIT" == "$BUCK_SUGGESTED_COMMIT" ]; then + echo "${BUCK_ACTUAL_COMMIT}" + elif [ ! -d "/opt/facebook" ]; then + echo "Warn: The test suite expects buck version ${BUCK_SUGGESTED_COMMIT} (${BUCK_SUGGESTED_V}) to be installed, but found ${BUCK_ACTUAL_COMMIT} instead" + fi fi # BUILD_TOOLS_VERSION is in a format like "23.0.1"