-
Notifications
You must be signed in to change notification settings - Fork 24.9k
infra(e2e): rework local E2E script #34513
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/** | ||
* 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'; | ||
|
||
const {exec, echo, exit, test, env} = require('shelljs'); | ||
const {revertFiles, saveFiles} = require('./scm-utils'); | ||
|
||
function saveFilesToRestore(tmpPublishingFolder) { | ||
const filesToSaveAndRestore = [ | ||
'template/Gemfile', | ||
'template/_ruby-version', | ||
'template/package.json', | ||
'.ruby-version', | ||
'Gemfile.lock', | ||
'Gemfile', | ||
'package.json', | ||
'ReactAndroid/gradle.properties', | ||
'Libraries/Core/ReactNativeVersion.js', | ||
'React/Base/RCTVersion.m', | ||
'ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java', | ||
'ReactCommon/cxxreact/ReactNativeVersion.h', | ||
]; | ||
|
||
saveFiles(filesToSaveAndRestore, tmpPublishingFolder); | ||
} | ||
|
||
function generateAndroidArtifacts(releaseVersion, tmpPublishingFolder) { | ||
// -------- Generating Android Artifacts | ||
env.REACT_NATIVE_SKIP_PREFAB = true; | ||
if (exec('./gradlew :ReactAndroid:installArchives').code) { | ||
echo('Could not generate artifacts'); | ||
exit(1); | ||
} | ||
|
||
// -------- Generating the Hermes Engine Artifacts | ||
env.REACT_NATIVE_HERMES_SKIP_PREFAB = true; | ||
if (exec('./gradlew :ReactAndroid:hermes-engine:installArchives').code) { | ||
echo('Could not generate artifacts'); | ||
exit(1); | ||
} | ||
|
||
// undo uncommenting javadoc setting | ||
revertFiles(['ReactAndroid/gradle.properties'], tmpPublishingFolder); | ||
|
||
echo('Generated artifacts for Maven'); | ||
|
||
let artifacts = [ | ||
'.module', | ||
'.pom', | ||
'-debug.aar', | ||
'-release.aar', | ||
'-debug-sources.jar', | ||
'-release-sources.jar', | ||
].map(suffix => { | ||
return `react-native-${releaseVersion}${suffix}`; | ||
}); | ||
|
||
artifacts.forEach(name => { | ||
if ( | ||
!test( | ||
'-e', | ||
`./android/com/facebook/react/react-native/${releaseVersion}/${name}`, | ||
) | ||
) { | ||
echo( | ||
`Failing as expected file: \n\ | ||
android/com/facebook/react/react-native/${releaseVersion}/${name}\n\ | ||
was not correctly generated.`, | ||
); | ||
exit(1); | ||
} | ||
}); | ||
} | ||
|
||
module.exports = { | ||
generateAndroidArtifacts, | ||
saveFilesToRestore, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
* 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 cleanAll) | ||
* - 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 cleanAll'); | ||
|
||
// iOS | ||
console.info('\n** Nuking the derived data folder **\n'); | ||
exec('rm -rf ~/Library/Developer/Xcode/DerivedData'); | ||
|
||
// RNTester Pods | ||
console.info('\n** Removing the RNTester Pods **\n'); | ||
exec('rm -rf packages/rn-tester/Pods'); | ||
|
||
// I'm not sure we want to also remove the lock file | ||
// exec('rm -rf packages/rn-tester/Podfile.lock'); | ||
|
||
// 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); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.