Skip to content

Commit

Permalink
Add existing Android checks to Circle.
Browse files Browse the repository at this point in the history
Summary:
Moving towards reusing existing scripts to ensure local and CI tests are kept in sync.
Closes facebook#18307

Differential Revision: D7222664

Pulled By: hramos

fbshipit-source-id: ecce91e32159c55b19c29eab69a6754642f02236
  • Loading branch information
hramos authored and macdoum1 committed Jun 28, 2018
1 parent 5705bb8 commit 6cdde7d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
22 changes: 17 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
|
Expand Down Expand Up @@ -136,15 +136,23 @@ 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
command: |
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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
19 changes: 15 additions & 4 deletions scripts/validate-android-test-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,42 @@ 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
echo "If you don't want to alter BUCKVERSION for other things running on"
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"
Expand Down

0 comments on commit 6cdde7d

Please sign in to comment.