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

[Circle] Add existing Android checks to Circle. #18307

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
22 changes: 17 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
|
Expand Down Expand Up @@ -128,15 +128,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 @@ -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
Expand All @@ -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
Expand All @@ -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
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