From 4265f86017baeaa44240ee6c8e828eae52836330 Mon Sep 17 00:00:00 2001 From: Hector Ramos Date: Fri, 9 Mar 2018 14:48:08 -0800 Subject: [PATCH] Add existing Android environment checks to Circle. --- .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 1b75edce484827..a6f79f72ec24e9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -81,8 +81,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 | @@ -128,8 +128,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 @@ -137,6 +137,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 @@ -440,6 +448,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 @@ -457,6 +467,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 @@ -474,7 +486,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 8b428e76fc4bdf..0461de767341d5 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"