Skip to content

Commit 1ff1e57

Browse files
hramosfacebook-github-bot
authored andcommitted
Add existing Android checks to Circle.
Summary: Moving towards reusing existing scripts to ensure local and CI tests are kept in sync. Closes #18307 Differential Revision: D7222664 Pulled By: hramos fbshipit-source-id: ecce91e32159c55b19c29eab69a6754642f02236
1 parent 274d6ce commit 1ff1e57

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

.circleci/config.yml

+17-5
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ aliases:
8989

9090
# Dependency Management
9191
- &install-ndk
92-
|
93-
source scripts/circle-ci-android-setup.sh && getAndroidNDK
92+
name: Install Android NDK
93+
command: source scripts/circle-ci-android-setup.sh && getAndroidNDK
9494

9595
- &yarn
9696
|
@@ -136,15 +136,23 @@ aliases:
136136
source $BASH_ENV
137137
138138
- &install-android-packages
139-
|
140-
source scripts/circle-ci-android-setup.sh && getAndroidSDK
139+
name: Install Android SDK Packages
140+
command: source scripts/circle-ci-android-setup.sh && getAndroidSDK
141141

142142
- &install-android-build-dependencies
143143
name: Install Android Build Dependencies
144144
command: |
145145
sudo apt-get update -y
146146
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
147147
148+
- &validate-android-sdk
149+
name: Validate Android SDK Install
150+
command: ./scripts/validate-android-sdk.sh
151+
152+
- &validate-android-test-env
153+
name: Validate Android Test Environment
154+
command: ./scripts/validate-android-test-env.sh
155+
148156
# Test Definitions
149157
- &run-js-tests
150158
name: JavaScript Test Suite
@@ -444,6 +452,8 @@ jobs:
444452
- run: *install-android-packages
445453
- save-cache: *save-cache-android-packages
446454

455+
- run: *validate-android-sdk
456+
447457
# Starting emulator in advance as it takes some time to boot.
448458
- run: *create-avd
449459
- run: *launch-avd
@@ -461,6 +471,8 @@ jobs:
461471
- run: *install-buck
462472
- save-cache: *save-cache-buck
463473

474+
- run: *validate-android-test-env
475+
464476
- run: buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
465477
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react
466478
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
@@ -478,7 +490,7 @@ jobs:
478490

479491
# Wait for AVD to finish booting before running tests
480492
- run: *wait-for-avd
481-
493+
482494
# Test Suite
483495
- run: *run-android-unit-tests
484496
- run: *run-android-instrumentation-tests

scripts/validate-android-test-env.sh

+15-4
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,42 @@ if [ -z "$(which buck)" ]; then
1414
exit 1
1515
fi
1616

17-
if [ -z "$(buck --version)" ]; then
17+
BUCK_ACTUAL_COMMIT=$(buck --version)
18+
BUCK_SUGGESTED_V="v2018.02.16.01"
19+
BUCK_SUGGESTED_COMMIT="d743d2d0229852ce7c029ec257532d8916f6b2b7"
20+
BUCK_SUGGESTED_COMMIT_FB="b9b76a3a5a086eb440a26d1db9b0731875975099"
21+
22+
if [ -z "$BUCK_ACTUAL_COMMIT" ]; then
1823
echo "Your Buck install is broken."
1924

2025
if [ -d "/opt/facebook" ]; then
21-
SUGGESTED="b9b76a3a5a086eb440a26d1db9b0731875975099"
26+
BUCK_SUGGESTED_COMMIT_FB="b9b76a3a5a086eb440a26d1db9b0731875975099"
2227
echo "FB laptops ship with a Buck config that is not compatible with open "
2328
echo "source. FB Buck requires the environment to set a buck version, but "
2429
echo "the open source version of Buck forbids that."
2530
echo
2631
echo "You can try setting:"
2732
echo
28-
echo "export BUCKVERSION=${SUGGESTED}"
33+
echo "export BUCKVERSION=${BUCK_SUGGESTED_COMMIT_FB}"
2934
echo
3035
echo "in your .bashrc or .bash_profile to fix this."
3136
echo
3237
echo "If you don't want to alter BUCKVERSION for other things running on"
3338
echo "your machine, you can just scope it to a single script, for example"
3439
echo "by running something like:"
3540
echo
36-
echo "BUCKVERSION=${SUGGESTED} $0"
41+
echo "BUCKVERSION=${BUCK_SUGGESTED_COMMIT_FB} $0"
3742
echo
3843
else
3944
echo "I don't know what's wrong, but calling 'buck --version' should work."
4045
fi
4146
exit 1
47+
else
48+
if [ "$BUCK_ACTUAL_COMMIT" == "$BUCK_SUGGESTED_COMMIT" ]; then
49+
echo "${BUCK_ACTUAL_COMMIT}"
50+
elif [ ! -d "/opt/facebook" ]; then
51+
echo "Warn: The test suite expects buck version ${BUCK_SUGGESTED_COMMIT} (${BUCK_SUGGESTED_V}) to be installed, but found ${BUCK_ACTUAL_COMMIT} instead"
52+
fi
4253
fi
4354

4455
# BUILD_TOOLS_VERSION is in a format like "23.0.1"

0 commit comments

Comments
 (0)