mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
f6197cd846
Summary: Testing releases takes a lot of time because we have to build locally several configurations. However, the artifacts that we build locally are also built in CI. The goal of this PR is to implement a mechanism to download those artifacts from the CI instead of build locally, so that testing the release locally can take much less time. As an example, the full test cycle can take more than 2 hours given that we need to repackage and rebuilt the app from the template. My plan is to add a table with the time saved once the PR is done ### TODO: - [x] Download Hermes tarball for RNTester iOS - [x] Download Hermes APK for RNTester Android - [x] Download JSC APK for RNTester Android - [x] Download Packaged version of React Native to create a new app - [x] Use the downloaded React Native to initialize an app from the template - [x] Download Maven Local prebuilt in CI and use it for Template Android app ### Time Savings | Setup | Before [s] | After [s] | Notes | | --- | --- | --- | --- | | iOS RNTester Hermes | 339.68 | 194.86 | Time saved by downloading Hermes rather then building it | | iOS RNTester JSC | 129.80 | 123.35 | Not significant, expected as this workflow did not change | Android RNTester Hermes | 1188.82 | 5.28 | Huge improvement: we download the APK rather then build | | Android RNTester JSC | 103.10 | 6.28 | Huge improvement: we download the APK rather then build | | Creating the RNTestProject | 2074.82 | 191.16 | We download Maven, the packaged version of RN and Hermes instead of building from scratch | ## Changelog: [Internal] - Speed up Release testing by downloading the CircleCI artifacts Pull Request resolved: https://github.com/facebook/react-native/pull/37971 Test Plan: - Tested the script locally Reviewed By: cortinico, dmytrorykun Differential Revision: D46859120 Pulled By: cipolleschi fbshipit-source-id: 8878ebaccf6edb801f8e9884e2bf3946380aa748
75 lines
2.2 KiB
JavaScript
75 lines
2.2 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
/*
|
|
* This script, paired with test-e2e-local.js, is the full suite of
|
|
* tooling needed for a successful local testing experience.
|
|
* This script is an helper to clean up the environment fully
|
|
* before running the test suite.
|
|
*
|
|
* You should use this when switching between branches.
|
|
*
|
|
* It will:
|
|
* - clean up node modules
|
|
* - clean up the build folder (derived data, gradlew clean)
|
|
* - clean up the pods folder for RNTester (pod install) (and Podfile.lock too)
|
|
* - kill all packagers
|
|
* - remove RNTestProject folder
|
|
*
|
|
* an improvements to consider:
|
|
* - an option to uninstall the apps (RNTester, RNTestProject) from emulators
|
|
*/
|
|
|
|
const {exec, exit} = require('shelljs');
|
|
|
|
const {isPackagerRunning} = require('./testing-utils');
|
|
|
|
console.info('\n** Starting the clean up process **\n');
|
|
|
|
// let's check if Metro is already running, if it is let's kill it and start fresh
|
|
if (isPackagerRunning() === 'running') {
|
|
exec("lsof -i :8081 | grep LISTEN | /usr/bin/awk '{print $2}' | xargs kill");
|
|
console.info('\n** Killed Metro **\n');
|
|
}
|
|
|
|
// Android
|
|
console.info('\n** Cleaning Gradle build artifacts **\n');
|
|
exec('./gradlew clean');
|
|
exec('rm -rf /tmp/maven-local');
|
|
exec('rm -rf /tmp/react-native-tmp');
|
|
|
|
// iOS
|
|
console.info('\n** Nuking the derived data folder **\n');
|
|
exec('rm -rf ~/Library/Developer/Xcode/DerivedData');
|
|
|
|
console.info('\n** Removing the hermes-engine pod cache **\n');
|
|
exec('rm -rf ~/Library/Caches/CocoaPods/Pods/External/hermes-engine');
|
|
|
|
// RNTester Pods
|
|
console.info('\n** Removing the RNTester Pods **\n');
|
|
exec('rm -rf packages/rn-tester/Pods');
|
|
|
|
// RNTestProject
|
|
console.info('\n** Removing the RNTestProject folder **\n');
|
|
exec('rm -rf /tmp/RNTestProject');
|
|
|
|
// final clean up
|
|
console.info('\n** Final git level wipe **\n');
|
|
// clean unstaged changes from git
|
|
exec('git checkout -- .');
|
|
// remove all the untracked files
|
|
exec('git clean -fdx');
|
|
|
|
console.info(
|
|
'\n** Clean up process completed\nPlease remember to run yarn install if you are planning to test again\n',
|
|
);
|
|
exit(0);
|