Compare commits

...
Author SHA1 Message Date
Blake Friedman 10e5b03474 Infra: clean out android build folder + add timing
- Removes packages/react-native/ReactAndroid/build as part of the release
testing steps.
- Added timing information to the release testing clean step.

Changelog: [Internal]

Test: Ran locally
2024-12-06 15:15:44 +00:00
2 changed files with 46 additions and 21 deletions
+29 -21
View File
@@ -30,10 +30,10 @@
*/
const {VERDACCIO_STORAGE_PATH} = require('../e2e/utils/verdaccio');
const {isPackagerRunning} = require('./utils/testing-utils');
const {isPackagerRunning, timeBlock} = require('./utils/testing-utils');
const {exec, exit} = require('shelljs');
console.info('\n** Starting the clean up process **\n');
console.info('** Starting the clean up process **');
// let's check if Metro is already running, if it is let's kill it and start fresh
if (isPackagerRunning() === 'running') {
@@ -42,35 +42,43 @@ if (isPackagerRunning() === 'running') {
}
// 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');
timeBlock('Cleaning Gradle build artifacts', () => {
exec('./gradlew clean');
exec('rm -rf package/react-native/ReactAndroid/build');
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');
timeBlock('Nuking the derived data folder', () => {
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');
timeBlock('Removing the hermes-engine pod cache', () => {
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');
timeBlock('Removing the RNTester Pods', () => {
exec('rm -rf packages/rn-tester/Pods');
});
// RNTestProject
console.info('\n** Removing the RNTestProject folder **\n');
exec('rm -rf /tmp/RNTestProject');
timeBlock('Removing the RNTestProject folder', () => {
exec('rm -rf /tmp/RNTestProject');
});
console.info('\n** Removing Verdaccio storage directory **\n');
exec(`rm -rf ${VERDACCIO_STORAGE_PATH}`);
timeBlock('Removing Verdaccio storage directory', () => {
exec(`rm -rf ${VERDACCIO_STORAGE_PATH}`);
});
// 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');
timeBlock('Final git level wipe', () => {
// 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',
@@ -21,6 +21,7 @@ const {
} = require('../../releases/utils/release-utils');
const circleCIArtifactsUtils = require('./circle-ci-artifacts-utils.js');
const ghaArtifactsUtils = require('./github-actions-utils.js');
const chalk = require('chalk');
const fs = require('fs');
// $FlowIgnore[cannot-resolve-module]
const {spawn} = require('node:child_process');
@@ -367,6 +368,21 @@ async function prepareArtifacts(
};
}
function timeBlock(label /*: string*/, block /*: () => void */) {
console.info(`\n⏲️ ${chalk.bold.green(label)}:\n`);
let failed = true;
const start = new Date().getTime();
try {
block();
failed = false;
} finally {
const delta = new Date().getTime() - start;
console.info(
`🏁 ${chalk.bold.blue(label)}${(delta / 1000).toFixed(0)}s to ${failed ? chalk.red('fail') : chalk.green('succeed')}.`,
);
}
}
module.exports = {
checkPackagerRunning,
maybeLaunchAndroidEmulator,
@@ -375,4 +391,5 @@ module.exports = {
setupCircleCIArtifacts,
setupGHAArtifacts,
prepareArtifacts,
timeBlock,
};