Switch e2e to yarn
Summary: Addresses CI build failures due to use of scoped packages by metro. Closes https://github.com/facebook/react-native/pull/17878 Differential Revision: D6914937 Pulled By: hramos fbshipit-source-id: e6ce97561035f4deb128cd1e30d81ab4edea3e4c
This commit is contained in:
parent
613afbab7f
commit
fa11faecb6
|
@ -112,7 +112,8 @@ aliases:
|
|||
sudo apt-get install -y nodejs
|
||||
|
||||
- &create-ndk-directory
|
||||
|
|
||||
name: Create Android NDK Directory
|
||||
command: |
|
||||
if [[ ! -e /opt/ndk ]]; then
|
||||
sudo mkdir /opt/ndk
|
||||
fi
|
||||
|
@ -121,7 +122,8 @@ aliases:
|
|||
# CircleCI does not support interpolating env variables in the environment
|
||||
# https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables
|
||||
- &configure-android-path
|
||||
|
|
||||
name: Configure Environment Variables
|
||||
command: |
|
||||
echo 'export PATH=${ANDROID_NDK}:~/react-native/gradle-2.9/bin:~/buck/bin:$PATH' >> $BASH_ENV
|
||||
source $BASH_ENV
|
||||
|
||||
|
@ -129,8 +131,9 @@ aliases:
|
|||
|
|
||||
source scripts/circle-ci-android-setup.sh && getAndroidSDK
|
||||
|
||||
- &install-build-dependencies
|
||||
|
|
||||
- &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
|
||||
|
||||
|
@ -171,7 +174,6 @@ aliases:
|
|||
- &build-js-bundle
|
||||
name: Build JavaScript Bundle
|
||||
command: node local-cli/cli.js bundle --max-workers 2 --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
|
||||
when: always
|
||||
|
||||
- &compile-native-libs
|
||||
name: Compile Native Libs for Unit and Integration Tests
|
||||
|
@ -184,7 +186,11 @@ aliases:
|
|||
|
||||
- &run-android-instrumentation-tests
|
||||
name: Run Instrumentation Tests
|
||||
command: source scripts/circle-ci-android-setup.sh && NO_BUCKD=1 retry3 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=$BUILD_THREADS
|
||||
command: |
|
||||
if [[ ! -e ReactAndroid/src/androidTest/assets/AndroidTestBundle.js ]]; then
|
||||
echo "JavaScript bundle missing, cannot run instrumentation tests. Verify build-js-bundle step completed successfully."; exit 1;
|
||||
fi
|
||||
source scripts/circle-ci-android-setup.sh && NO_BUCKD=1 retry3 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=$BUILD_THREADS
|
||||
|
||||
- &collect-android-test-results
|
||||
name: Collect Test Results
|
||||
|
@ -254,6 +260,8 @@ jobs:
|
|||
path: ~/reports/junit
|
||||
- store_artifacts:
|
||||
path: ~/reports/junit
|
||||
- store_artifacts:
|
||||
path: ~/react-native/yarn.lock
|
||||
|
||||
# Runs JavaScript tests on Node 8
|
||||
js-node-8:
|
||||
|
@ -387,7 +395,7 @@ jobs:
|
|||
|
||||
# Configure Android dependencies
|
||||
- run: *configure-android-path
|
||||
- run: *install-build-dependencies
|
||||
- run: *install-android-build-dependencies
|
||||
- restore-cache: *restore-cache-android-packages
|
||||
- run: *install-android-packages
|
||||
- save-cache: *save-cache-android-packages
|
||||
|
@ -430,9 +438,9 @@ jobs:
|
|||
- checkout
|
||||
- run: *setup-artifacts
|
||||
|
||||
# Configure Android dependencies
|
||||
# Configure Android SDK and related dependencies
|
||||
- run: *configure-android-path
|
||||
- run: *install-build-dependencies
|
||||
- run: *install-android-build-dependencies
|
||||
- restore-cache: *restore-cache-android-packages
|
||||
- run: *install-android-packages
|
||||
- save-cache: *save-cache-android-packages
|
||||
|
@ -442,11 +450,8 @@ jobs:
|
|||
- run: *launch-avd
|
||||
|
||||
# Keep configuring Android dependencies while AVD boots up
|
||||
- run: *create-ndk-directory
|
||||
- restore-cache: *restore-cache-ndk
|
||||
- run: *install-ndk
|
||||
- save-cache: *save-cache-ndk
|
||||
|
||||
# Fetch dependencies using BUCK
|
||||
- restore-cache: *restore-cache-buck
|
||||
- run: *install-buck
|
||||
- save-cache: *save-cache-buck
|
||||
|
@ -458,10 +463,17 @@ jobs:
|
|||
- run: buck fetch ReactAndroid/src/androidTest/...
|
||||
- run: ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog :ReactAndroid:downloadJSCHeaders
|
||||
|
||||
# Install Android NDK
|
||||
- run: *create-ndk-directory
|
||||
- restore-cache: *restore-cache-ndk
|
||||
- run: *install-ndk
|
||||
- save-cache: *save-cache-ndk
|
||||
|
||||
# Build and compile
|
||||
- run: *build-android-app
|
||||
- run: *compile-native-libs
|
||||
|
||||
# The JavaScript Bundle is required for instrumentation tests.
|
||||
# Build JavaScript Bundle for instrumentation tests
|
||||
- run: *install-node
|
||||
- run: *install-yarn
|
||||
- restore-cache: *restore-yarn-cache
|
||||
|
@ -472,7 +484,7 @@ jobs:
|
|||
# Wait for AVD to finish booting before running tests
|
||||
- run: *wait-for-avd
|
||||
|
||||
# Tests
|
||||
# Test Suite
|
||||
- run: *run-android-unit-tests
|
||||
- run: *run-android-instrumentation-tests
|
||||
|
||||
|
|
|
@ -51,6 +51,9 @@ node_modules
|
|||
*.log
|
||||
.nvm
|
||||
/bots/node_modules/
|
||||
|
||||
# TODO: Check in yarn.lock in open source. Right now we need to keep it out
|
||||
# from the GitHub repo as importing it might conflict with internal workspaces
|
||||
*/**/yarn.lock
|
||||
|
||||
# OS X
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* --android - 'react-native init' and check Android app doesn't redbox
|
||||
* --js - 'react-native init' and only check the packager returns a bundle
|
||||
* --skip-cli-install - to skip react-native-cli global installation (for local debugging)
|
||||
* --retries [num] - how many times to retry possible flaky commands: npm install and running tests, default 1
|
||||
* --retries [num] - how many times to retry possible flaky commands: yarn add and running tests, default 1
|
||||
*/
|
||||
/*eslint-disable no-undef */
|
||||
require('shelljs/global');
|
||||
|
@ -44,12 +44,12 @@ let exitCode;
|
|||
try {
|
||||
// install CLI
|
||||
cd('react-native-cli');
|
||||
exec('npm pack');
|
||||
exec('yarn pack');
|
||||
const CLI_PACKAGE = path.join(ROOT, 'react-native-cli', 'react-native-cli-*.tgz');
|
||||
cd('..');
|
||||
|
||||
if (!argv['skip-cli-install']) {
|
||||
if (exec(`sudo npm install -g ${CLI_PACKAGE}`).code) {
|
||||
if (exec(`sudo yarn global add ${CLI_PACKAGE}`).code) {
|
||||
echo('Could not install react-native-cli globally.');
|
||||
echo('Run with --skip-cli-install to skip this step');
|
||||
exitCode = 1;
|
||||
|
@ -65,7 +65,7 @@ try {
|
|||
}
|
||||
}
|
||||
|
||||
if (exec('npm pack').code) {
|
||||
if (exec('yarn pack').code) {
|
||||
echo('Failed to pack react-native');
|
||||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
|
@ -76,7 +76,7 @@ try {
|
|||
if (tryExecNTimes(
|
||||
() => {
|
||||
exec('sleep 10s');
|
||||
return exec(`react-native init EndToEndTest --version ${PACKAGE} --npm`).code;
|
||||
return exec(`react-native init EndToEndTest --version ${PACKAGE}`).code;
|
||||
},
|
||||
numberOfRetries,
|
||||
() => rm('-rf', 'EndToEndTest'))) {
|
||||
|
@ -92,7 +92,7 @@ try {
|
|||
echo('Running an Android e2e test');
|
||||
echo('Installing e2e framework');
|
||||
if (tryExecNTimes(
|
||||
() => exec('npm install --save-dev appium@1.5.1 mocha@2.4.5 wd@0.3.11 colors@1.0.3 pretty-data2@0.40.1', { silent: true }).code,
|
||||
() => exec('yarn add --dev appium@1.5.1 mocha@2.4.5 wd@0.3.11 colors@1.0.3 pretty-data2@0.40.1', { silent: true }).code,
|
||||
numberOfRetries)) {
|
||||
echo('Failed to install appium');
|
||||
echo('Most common reason is npm registry connectivity, try again');
|
||||
|
@ -125,7 +125,7 @@ try {
|
|||
|
||||
echo(`Starting packager server, ${SERVER_PID}`);
|
||||
// shelljs exec('', {async: true}) does not emit stdout events, so we rely on good old spawn
|
||||
const packagerProcess = spawn('npm', ['start', '--', '--max-workers 1'], {
|
||||
const packagerProcess = spawn('yarn', ['start', '--max-workers 1'], {
|
||||
env: process.env
|
||||
});
|
||||
SERVER_PID = packagerProcess.pid;
|
||||
|
@ -158,7 +158,7 @@ try {
|
|||
// shelljs exec('', {async: true}) does not emit stdout events, so we rely on good old spawn
|
||||
const packagerEnv = Object.create(process.env);
|
||||
packagerEnv.REACT_NATIVE_MAX_WORKERS = 1;
|
||||
const packagerProcess = spawn('npm', ['start', '--', '--nonPersistent'],
|
||||
const packagerProcess = spawn('yarn', ['start', '--nonPersistent'],
|
||||
{
|
||||
stdio: 'inherit',
|
||||
env: packagerEnv
|
||||
|
@ -204,7 +204,7 @@ try {
|
|||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
}
|
||||
if (exec('npm test').code) {
|
||||
if (exec('yarn test').code) {
|
||||
echo('Jest test failure');
|
||||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
|
|
Loading…
Reference in New Issue