Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
7750cff
Fix pipeline
thewulf7 Dec 12, 2022
21d67ff
Update react-native-code-push-ci.yml
thewulf7 Dec 12, 2022
db27ec6
Update react-native-code-push-ci.yml
thewulf7 Dec 12, 2022
02dc07f
Update react-native-code-push-ci.yml
thewulf7 Dec 12, 2022
b7dadf4
Update react-native-code-push-ci.yml
thewulf7 Dec 12, 2022
594e609
Update react-native-code-push-ci.yml
thewulf7 Dec 12, 2022
9eb0bb8
Update react-native-code-push-ci.yml
thewulf7 Dec 12, 2022
b72dc43
Update react-native-code-push-ci.yml
thewulf7 Dec 12, 2022
e06d473
Update react-native-code-push-ci.yml
thewulf7 Dec 12, 2022
caa7d07
Update react-native-code-push-ci.yml
thewulf7 Dec 12, 2022
bdf1afe
Update react-native-code-push-ci.yml
thewulf7 Dec 12, 2022
9abe4e7
Update react-native-code-push-ci.yml
thewulf7 Dec 12, 2022
e59af04
Update platform.js
thewulf7 Dec 12, 2022
637e61e
Update platform.js
thewulf7 Dec 13, 2022
b7b5d17
Update react-native-code-push-ci.yml
thewulf7 Dec 13, 2022
a747138
Update react-native-code-push-ci.yml
thewulf7 Dec 13, 2022
55a91ea
Update platform.js
thewulf7 Dec 13, 2022
9d6a910
Update platform.js
thewulf7 Dec 13, 2022
a680d2a
Update platform.js
thewulf7 Dec 13, 2022
77544be
Update platform.js
thewulf7 Dec 13, 2022
14d8cc9
Update platform.js
thewulf7 Dec 13, 2022
4abfe71
Update platform.js
thewulf7 Dec 13, 2022
58c38f2
Update react-native-code-push-ci.yml
thewulf7 Dec 13, 2022
5af902c
Update test.ts
thewulf7 Dec 14, 2022
d414665
Update test.ts
thewulf7 Dec 14, 2022
fd32ddb
Update test.ts
thewulf7 Dec 15, 2022
8b49ddf
Update react-native-code-push-ci.yml
thewulf7 Dec 15, 2022
69bba3a
Fix: react-native init command error (#2377)
Kwonkunkun Dec 13, 2022
c066c8a
Add more logging
thewulf7 Dec 15, 2022
280ebf8
Add more logging
thewulf7 Dec 15, 2022
a540df1
Add more logging
thewulf7 Dec 15, 2022
834e299
Add more logging
thewulf7 Dec 15, 2022
7e372d9
Merge branch 'master' into thewulf7-patch-1
thewulf7 Dec 15, 2022
3d5d0c9
Add more logging
thewulf7 Dec 15, 2022
525887a
Add more logging
thewulf7 Dec 16, 2022
03a0b94
Add more logging
thewulf7 Dec 16, 2022
798ebf5
Add more logging
thewulf7 Dec 16, 2022
2c7faa5
Add more logging
thewulf7 Dec 16, 2022
1d64b07
Add more logging
thewulf7 Dec 16, 2022
c083faf
Add more logging
thewulf7 Dec 16, 2022
e86c10f
Add more logging
thewulf7 Dec 17, 2022
89fdd4b
Add more logging
thewulf7 Dec 17, 2022
513d834
Add more logging
thewulf7 Dec 17, 2022
dc6a833
Add more logging
thewulf7 Dec 17, 2022
3e367bb
Add more logging
thewulf7 Dec 18, 2022
c39139b
Add more logging
thewulf7 Dec 18, 2022
c5fc7cf
Add more logging
thewulf7 Dec 18, 2022
721f83e
Add more logging
thewulf7 Dec 18, 2022
1c379fc
Add more logging
thewulf7 Dec 18, 2022
6e81dcb
Add more logging
thewulf7 Dec 18, 2022
10234ba
Add more logging
thewulf7 Dec 18, 2022
332633d
Add more logging
thewulf7 Dec 19, 2022
ae44359
Add more logging
thewulf7 Dec 19, 2022
c531151
Add more logging
thewulf7 Dec 19, 2022
de5519d
Add more logging
thewulf7 Dec 19, 2022
c1b498f
Add more logging
thewulf7 Dec 19, 2022
b25f2ce
Add more logging
thewulf7 Dec 19, 2022
13a685c
Add more logging
thewulf7 Dec 19, 2022
d610ca9
Add more logging
thewulf7 Dec 19, 2022
c201c3c
Add more logging
thewulf7 Dec 22, 2022
3e80cad
Add more logging
thewulf7 Dec 22, 2022
fbf1428
Add more logging
thewulf7 Dec 23, 2022
ce930c2
Add more logging
thewulf7 Dec 23, 2022
96f33bc
Add more logging
thewulf7 Dec 24, 2022
aa2d2b7
Add more logging
thewulf7 Dec 24, 2022
980678d
Add more logging
thewulf7 Dec 24, 2022
0e411a7
Add more logging
thewulf7 Dec 25, 2022
b476347
Update react-native-code-push-ci.yml
thewulf7 Jan 3, 2023
1fd188c
Update testConfig.js
thewulf7 Jan 3, 2023
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: 20 additions & 17 deletions .github/workflows/react-native-code-push-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ jobs:
uses: actions/checkout@v3
- name: Start adb server
run: adb devices
- name: Gradle cache
uses: gradle/gradle-build-action@v2
- name: Download system image "android-${{ matrix.api-level }}"
run: $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-${{ matrix.api-level }};google_apis;x86"
- name: Create android emulator
run: $ANDROID_HOME/tools/bin/avdmanager create avd --force --name TestEmulator --abi google_apis/x86 --package 'system-images;android-${{ matrix.api-level }};google_apis;x86' --device "Nexus 6P"
- name: Start android emulator
run: $ANDROID_HOME/emulator/emulator -avd TestEmulator -noaudio -no-window -no-snapshot-save -no-boot-anim -memory 6144 &
- run: sleep 120
- name: Wait for emulator to boot
run: $ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done'
- run: adb shell settings put global window_animation_scale 0.0
- run: adb shell settings put global transition_animation_scale 0.0
- run: adb shell settings put global animator_duration_scale 0.0
Expand All @@ -32,34 +35,34 @@ jobs:
with:
distribution: 'microsoft'
java-version: '11'
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.4'
bundler-cache: true
- name: Package Installation
run: npm i
- name: Install react-native
run: npm install -g react-native
run: npm install
- name: Setup Android tests
run: npm run build:tests && npm run test:setup:android
- name: Remove react-native
run: npm remove -g react-native
- name: Install react-native-cli
run: npm install -g react-native-cli
- name: Run Android test
run: npm run test:fast:android

test-iOS:
name: Test iOS app
runs-on: macos-latest
env:
NO_FLIPPER: ${{ secrets.NO_FLIPPER }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependecies
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.4'
bundler-cache: true
- name: Install dependencies
run: npm install
- name: Install react-native-cli
run: npm install react-native-cli
- name: Install reacti-native
run: npm install react-native
- name: Build tests
run: npm run build:tests
- name: Setup tests
run: npm run test:setup:ios
- name: Setup iOS tests
run: npm run build:tests && npm run test:setup:ios
- name: Run tests
run: npm run test:fast:ios
24 changes: 13 additions & 11 deletions code-push-plugin-testing-framework/script/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@ function bootEmulatorInternal(platformName, restartEmulators, targetEmulator, ch
var checkDeferred = Q.defer();
console.log("Checking if " + platformName + " emulator is ready yet...");
// Dummy command that succeeds if emulator is ready and fails otherwise.
checkEmulator()
checkEmulator(targetEmulator)
.then(function () {
checkDeferred.resolve(undefined);
}, function (error) {
console.info(error);
console.log(platformName + " emulator is not ready yet!");
checkDeferred.reject(error);
});
Expand Down Expand Up @@ -198,7 +199,7 @@ var AndroidEmulatorManager = (function () {
* Boots the target emulator.
*/
AndroidEmulatorManager.prototype.bootEmulator = function (restartEmulators) {
function checkAndroidEmulator() {
function checkAndroidEmulator(androidEmulatorName) {
// A command that does nothing but only succeeds if the emulator is running.
// List all of the packages on the device.
return testUtil_1.TestUtil.getProcessOutput("adb shell pm list packages", { noLogCommand: true, noLogStdOut: true, noLogStdErr: true }).then(function () { return null; });
Expand Down Expand Up @@ -300,9 +301,9 @@ var IOSEmulatorManager = (function () {
testUtil_1.TestUtil.getProcessOutput("xcrun simctl list", { noLogCommand: true, noLogStdOut: true, noLogStdErr: true })
.then((listOfDevicesWithDevicePairs) => {
let listOfDevices = listOfDevicesWithDevicePairs.slice(listOfDevicesWithDevicePairs.indexOf("-- iOS"), listOfDevicesWithDevicePairs.indexOf("-- tvOS"));
let phoneDevice = /iPhone (\S* )*(\(([0-9A-Z-]*)\))/g;
let match = listOfDevices.match(phoneDevice);
deferred.resolve(match[match.length - 1]);
let phoneDevice = /iPhone\ \S*\ ?.*?\(([0-9A-Z-]*)\)/g;
let match = phoneDevice.exec(listOfDevices);
deferred.resolve(match[1]);
}, (error) => {
deferred.reject(error);
});
Expand All @@ -323,17 +324,18 @@ var IOSEmulatorManager = (function () {
* Boots the target emulator.
*/
IOSEmulatorManager.prototype.bootEmulator = function (restartEmulators) {
function checkIOSEmulator() {
function checkIOSEmulator(iOSEmulatorId) {
// A command that does nothing but only succeeds if the emulator is running.
// Get the environment variable with the name "asdf" (return null, not an error, if not initialized).
return testUtil_1.TestUtil.getProcessOutput("xcrun simctl getenv booted asdf", { noLogCommand: true, noLogStdOut: true, noLogStdErr: true }).then(function () { return null; });
return testUtil_1.TestUtil.getProcessOutput("xcrun simctl getenv booted SIMULATOR_UDID", { noLogCommand: true, noLogStdOut: true, noLogStdErr: true }).then(function (simUdid) {
return simUdid.trim() == iOSEmulatorId.trim() ? true : Promise.reject(new Error('Waiting for device to boot'));
});
}
function startIOSEmulator(iOSEmulatorName) {
return testUtil_1.TestUtil.getProcessOutput("xcrun instruments -w \"" + iOSEmulatorName + "\"", { noLogStdErr: true })
function startIOSEmulator(iOSEmulatorId) {
return testUtil_1.TestUtil.getProcessOutput("xcrun simctl boot " + iOSEmulatorId, { noLogStdErr: true })
.catch(function (error) { return undefined; /* Always fails because we do not specify a template, which is not necessary to just start the emulator */ }).then(function () { return null; });
}
function killIOSEmulator() {
return testUtil_1.TestUtil.getProcessOutput("killall Simulator").then(function () { return null; });
return testUtil_1.TestUtil.getProcessOutput("xcrun simctl shutdown all").then(function () { return null; });
}
return this.getTargetEmulator()
.then(function (targetEmulator) {
Expand Down
2 changes: 1 addition & 1 deletion code-push-plugin-testing-framework/script/testConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports.TestAppName = "TestCodePush";
exports.TestNamespace = "com.testcodepush";
exports.AcquisitionSDKPluginName = "code-push";
exports.templatePath = path.join(__dirname, "../../test/template");
exports.thisPluginInstallString = TestUtil_1.TestUtil.resolveBooleanVariables(process.env.NPM) ? `npm install ${NPM_PLUGIN_PATH}` : `npm pack ${DEFAULT_PLUGIN_PATH} && npm install ${DEFAULT_PLUGIN_TGZ_NAME}`;
exports.thisPluginInstallString = TestUtil_1.TestUtil.resolveBooleanVariables(process.env.NPM) ? `npm install ${NPM_PLUGIN_PATH}` : `npm pack ${DEFAULT_PLUGIN_PATH} && npm install ${DEFAULT_PLUGIN_TGZ_NAME} && npm link`;
exports.testRunDirectory = process.env.RUN_DIR ? process.env.RUN_DIR: DEFAULT_TEST_RUN_DIRECTORY;
exports.updatesDirectory = process.env.UPDATE_DIR ? process.env.UPDATE_DIR : DEFAULT_UPDATES_DIRECTORY;
exports.onlyRunCoreTests = TestUtil_1.TestUtil.resolveBooleanVariables(process.env.CORE);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"archiver": "latest",
"body-parser": "latest",
"code-push-plugin-testing-framework": "file:./code-push-plugin-testing-framework",
"del": "latest",
"del": "v6.0.0",
"express": "latest",
"mkdirp": "latest",
"mocha": "^9.2.0",
Expand Down
13 changes: 6 additions & 7 deletions test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ class RNIOS extends Platform.IOS implements RNPlatform {
const infoPlistPath: string = path.join(iOSProject, TestConfig.TestAppName, "Info.plist");
const appDelegatePath: string = path.join(iOSProject, TestConfig.TestAppName, "AppDelegate.m");


// Install the Podfile
return TestUtil.getProcessOutput("pod install", { cwd: iOSProject })
// Put the IOS deployment key in the Info.plist
Expand Down Expand Up @@ -229,15 +230,13 @@ class RNIOS extends Platform.IOS implements RNPlatform {

return this.getEmulatorManager().getTargetEmulator()
.then((targetEmulator: string) => {
const hashRegEx = /[(][0-9A-Z-]*[)]/g;
const hashWithParen = targetEmulator.match(hashRegEx)[0];
const hash = hashWithParen.substr(1, hashWithParen.length - 2);
return TestUtil.getProcessOutput("xcodebuild -workspace " + path.join(iOSProject, TestConfig.TestAppName) + ".xcworkspace -scheme " + TestConfig.TestAppName +
" -configuration Release -destination \"platform=iOS Simulator,id=" + hash + "\" -derivedDataPath build EXCLUDED_ARCHS=arm64", { cwd: iOSProject, maxBuffer: 1024 * 1024 * 500, noLogStdOut: true });
" -configuration Release -destination \"platform=iOS Simulator,id=" + targetEmulator + "\" -derivedDataPath build EXCLUDED_ARCHS=arm64", { cwd: iOSProject, timeout: 30 * 60 * 1000, maxBuffer: 1024 * 1024 * 5000, noLogStdOut: true });
})
.then<void>(
() => { return null; },
() => {
(error: any) => {
console.info(error);
// The first time an iOS project is built, it fails because it does not finish building libReact.a before it builds the test app.
// Simply build again to fix the issue.
if (!RNIOS.iosFirstBuild[projectDirectory]) {
Expand Down Expand Up @@ -308,7 +307,7 @@ class RNProjectManager extends ProjectManager {
}
mkdirp.sync(projectDirectory);

return TestUtil.getProcessOutput("npx react-native init " + appName, { cwd: projectDirectory, timeout: 30 * 60 * 1000 })
return TestUtil.getProcessOutput("npx react-native init " + appName + " --version 0.67.1", { cwd: projectDirectory, timeout: 30 * 60 * 1000 })
.then((e) => { console.log(`"npx react-native init ${appName}" success. cwd=${projectDirectory}`); return e; })
.then(this.copyTemplate.bind(this, templatePath, projectDirectory))
.then<void>(TestUtil.getProcessOutput.bind(undefined, TestConfig.thisPluginInstallString, { cwd: path.join(projectDirectory, TestConfig.TestAppName) }))
Expand Down Expand Up @@ -378,7 +377,7 @@ class RNProjectManager extends ProjectManager {
deferred.resolve(undefined);
});
return deferred.promise
.then(TestUtil.getProcessOutput.bind(undefined, "react-native bundle --platform " + targetPlatform.getName() + " --entry-file index." + targetPlatform.getName() + ".js --bundle-output " + bundlePath + " --assets-dest " + bundleFolder + " --dev false",
.then(TestUtil.getProcessOutput.bind(undefined, "npx react-native bundle --platform " + targetPlatform.getName() + " --entry-file index." + targetPlatform.getName() + ".js --bundle-output " + bundlePath + " --assets-dest " + bundleFolder + " --dev false",
{ cwd: path.join(projectDirectory, TestConfig.TestAppName) }))
.then<string>(TestUtil.archiveFolder.bind(undefined, bundleFolder, "", path.join(projectDirectory, TestConfig.TestAppName, "update.zip"), isDiff));
}
Expand Down