Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix release testing script #43130

Closed
wants to merge 1 commit into from
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
37 changes: 18 additions & 19 deletions scripts/e2e/init-template-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ async function main() {
}

await initNewProjectFromSource(options);

// TODO(T179377112): Fix memory leak from `spawn` in `setupVerdaccio` (above
// kill command does not wait for kill success).
process.exit(0);
}

async function initNewProjectFromSource(
Expand Down Expand Up @@ -122,48 +126,43 @@ async function initNewProjectFromSource(
{
// Avoid loading packages/react-native/react-native.config.js
cwd: REPO_ROOT,
stdio: verbose ? 'inherit' : [process.stderr],
stdio: 'inherit',
},
);
console.log('\nDone ✅');

console.log('Installing project dependencies');
await runYarnUsingProxy(directory);
await installProjectUsingProxy(directory);
console.log('Done ✅');
} catch (e) {
console.log('Failed ❌');
throw e;
} finally {
console.log(`Cleanup: Killing Verdaccio process (PID: ${verdaccioPid})`);
execSync(`kill -9 ${verdaccioPid}`);
console.log('Done ✅');

try {
execSync(`kill -9 ${verdaccioPid}`);
console.log('Done ✅');
} catch {
console.warn('Failed to kill Verdaccio process');
}
console.log('Cleanup: Removing Verdaccio storage directory');
execSync(`rm -rf ${VERDACCIO_STORAGE_PATH}`);
console.log('Done ✅');

// TODO(huntie): Fix memory leak from `spawn` in `setupVerdaccio` (above
// kill command does not wait for kill success).
process.exit(0);
}
}

async function runYarnUsingProxy(cwd /*: string */) {
async function installProjectUsingProxy(cwd /*: string */) {
const execOptions = {
cwd,
stdio: 'inherit',
};
execSync(
`yarn config set npmRegistryServer "${VERDACCIO_SERVER_URL}"`,
execOptions,
);
execSync(
'yarn config set unsafeHttpWhitelist --json \'["localhost"]\'',
execOptions,
);

// TODO(huntie): Review pre-existing retry limit
const success = await retry('yarn', execOptions, 3, 500, ['install']);
const success = await retry('npm', execOptions, 3, 500, [
'install',
'--registry',
VERDACCIO_SERVER_URL,
]);

if (!success) {
throw new Error('Failed to install project dependencies');
Expand Down
16 changes: 13 additions & 3 deletions scripts/release-testing/test-e2e-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const {
prepareArtifacts,
setupCircleCIArtifacts,
} = require('./utils/testing-utils');
const chalk = require('chalk');
const debug = require('debug')('test-e2e-local');
const fs = require('fs');
const path = require('path');
Expand Down Expand Up @@ -301,10 +302,10 @@ async function testRNTestProject(
);

cd('..');
exec('yarn ios');
exec('npm run ios');
} else {
// android
exec('yarn android');
exec('npm run android');
}
popd();
}
Expand All @@ -329,14 +330,23 @@ async function main() {

let circleCIArtifacts = await setupCircleCIArtifacts(
// $FlowIgnoreError[prop-missing]
argv.circleCIToken,
argv.circleciToken,
branchName,
);

if (argv.target === 'RNTester') {
await testRNTester(circleCIArtifacts, onReleaseBranch);
} else {
await testRNTestProject(circleCIArtifacts);

console.warn(
chalk.yellow(`
================================================================================
NOTE: Verdaccio may still be running on after this script has finished. Please
Force Quit via Activity Monitor.
================================================================================
`),
);
}
}

Expand Down
Loading