Skip to content
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
17 changes: 15 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,23 @@ jobs:
- checkout
- run: *setup-artifacts

- restore-cache: *restore-yarn-cache
- restore-cache: *restore-cache-analysis
- run: *yarn

- run:
name: Analyze Shell Scripts
command: |
if [ -n "$CIRCLE_PR_NUMBER" ]; then
echo -e "\\x1B[36mInstalling additional dependencies\\x1B[0m"
sudo apt-get install -y shellcheck
yarn add @octokit/[email protected]
echo -e "\\x1B[36mAnalyzing shell scripts\\x1B[0m"
GITHUB_TOKEN="$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A""$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B" ./scripts/circleci/analyze_scripts.sh
else
echo "Skipping shell script analysis."
fi
when: always

- run:
name: Analyze Code
command: |
Expand All @@ -599,7 +613,6 @@ jobs:
fi
when: always

- restore-cache: *restore-cache-analysis
- run:
name: Analyze Pull Request
command: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mount -o remount,exec /dev/shm
AVD_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)

# create virtual device
echo no | android create avd -n $AVD_UUID -f -t android-19 --abi default/armeabi-v7a
echo no | android create avd -n "$AVD_UUID" -f -t android-19 --abi default/armeabi-v7a

# emulator setup
emulator64-arm -avd $AVD_UUID -no-skin -no-audio -no-window -no-boot-anim &
Expand All @@ -28,8 +28,9 @@ watchman shutdown-server
node local-cli/cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js

# build test APK
# shellcheck disable=SC1091
source ./scripts/android-setup.sh && NO_BUCKD=1 retry3 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=1

# run installed apk with tests
node ./ContainerShip/scripts/run-android-ci-instrumentation-tests.js $*
node ./ContainerShip/scripts/run-android-ci-instrumentation-tests.js "$*"
exit $?
2 changes: 1 addition & 1 deletion ContainerShip/scripts/run-android-docker-unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ mount -o remount,exec /dev/shm
set -x

# run unit tests
buck test ReactAndroid/src/test/... --config build.threads=$UNIT_TESTS_BUILD_THREADS
buck test ReactAndroid/src/test/... --config build.threads="$UNIT_TESTS_BUILD_THREADS"
9 changes: 5 additions & 4 deletions ContainerShip/scripts/run-ci-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ function e2e_suite() {
emulator64-arm -avd "$AVD_UUID" -no-skin -no-audio -no-window -no-boot-anim &

bootanim=""
# shellcheck disable=SC2076
until [[ "$bootanim" =~ "stopped" ]]; do
sleep 5
bootanim=$(adb -e shell getprop init.svc.bootanim 2>&1)
Expand Down Expand Up @@ -210,15 +211,15 @@ function e2e_suite() {
fi

# kill packager process
if kill -0 $SERVER_PID; then
if kill -0 "$SERVER_PID"; then
echo "Killing packager $SERVER_PID"
kill -9 $SERVER_PID
kill -9 "$SERVER_PID"
fi

# kill appium process
if kill -0 $APPIUM_PID; then
if kill -0 "$APPIUM_PID"; then
echo "Killing appium $APPIUM_PID"
kill -9 $APPIUM_PID
kill -9 "$APPIUM_PID"
fi

fi
Expand Down
10 changes: 5 additions & 5 deletions ContainerShip/scripts/run-instrumentation-tests-via-adb-shell.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

# shellcheck disable=SC1117
# Python script to run instrumentation tests, copied from https://github.com/circleci/circle-dummy-android
# Example: ./scripts/run-android-instrumentation-tests.sh com.facebook.react.tests com.facebook.react.tests.ReactPickerTestCase
#
Expand All @@ -9,7 +9,7 @@ export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$PATH"
adb logcat -c

# run tests and check output
python - $1 $2 << END
python - "$1" "$2" << END

import re
import subprocess as sp
Expand All @@ -24,7 +24,7 @@ test_class = None

if len(sys.argv) > 2:
test_class = sys.argv[2]

def update():
# prevent CircleCI from killing the process for inactivity
while not done:
Expand All @@ -38,10 +38,10 @@ t.start()
def run():
sp.Popen(['adb', 'wait-for-device']).communicate()
if (test_class != None):
p = sp.Popen('adb shell am instrument -w -e class %s %s/android.support.test.runner.AndroidJUnitRunner'
p = sp.Popen('adb shell am instrument -w -e class %s %s/android.support.test.runner.AndroidJUnitRunner'
% (test_class, test_app), shell=True, stdout=sp.PIPE, stderr=sp.PIPE, stdin=sp.PIPE)
else :
p = sp.Popen('adb shell am instrument -w %s/android.support.test.runner.AndroidJUnitRunner'
p = sp.Popen('adb shell am instrument -w %s/android.support.test.runner.AndroidJUnitRunner'
% (test_app), shell=True, stdout=sp.PIPE, stderr=sp.PIPE, stdin=sp.PIPE)
return p.communicate()

Expand Down
1 change: 1 addition & 0 deletions bots/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"danger": "node ./node_modules/.bin/danger"
},
"devDependencies": {
"@octokit/rest": "15.10.0",
"danger": "^2.1.6",
"lodash.includes": "^4.3.0",
"minimatch": "^3.0.4"
Expand Down
Loading