Skip to content

Commit 4aeb269

Browse files
committed
Overlap simulator boot with the rest of the iOS E2E setup
The iOS E2E action did all of its setup one step after another before touching the simulator. `xcrun simctl install` then waited ~2 minutes for the simulator to finish booting. - Start booting the simulator as the first step (new `boot` subcommand of maestro-ios.js), so it boots while Maestro, Java, the node modules and Metro are being set up. - Drop the `idb-companion` install. Maestro removed its IDB dependency on iOS in 1.x (see "Removed IDB on iOS" in its changelog) and 2.6.1 doesn't reference it. - Drop the second Node.js setup: both callers (RNTester and the template app) already set up Node.js before using the action.
1 parent 79a54ab commit 4aeb269

2 files changed

Lines changed: 30 additions & 11 deletions

File tree

‎.github/actions/maestro-ios/action.yml‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,23 @@ inputs:
3737

3838
runs:
3939
using: composite
40+
# Expects Node.js to be set up by the calling job.
4041
steps:
42+
# Booting takes a couple of minutes; it finishes while the next steps run.
43+
- name: Boot simulator
44+
shell: bash
45+
run: |
46+
node .github/workflow-scripts/maestro-ios.js boot \
47+
"${{ inputs.device-model }}" \
48+
"${{ inputs.device-os }}"
4149
- name: Installing Maestro
4250
shell: bash
4351
run: export MAESTRO_VERSION=2.6.1; curl -Ls "https://get.maestro.mobile.dev" | bash
44-
- name: Installing Maestro dependencies
45-
shell: bash
46-
run: |
47-
brew tap facebook/fb
48-
brew install facebook/fb/idb-companion
4952
- name: Set up JDK 17
5053
uses: actions/setup-java@v5
5154
with:
5255
java-version: '17'
5356
distribution: 'zulu'
54-
- name: Setup node.js
55-
uses: ./.github/actions/setup-node
5657
- name: Run yarn install
5758
uses: ./.github/actions/yarn-install
5859
- name: Start Metro in Debug

‎.github/workflow-scripts/maestro-ios.js‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ node maestro-ios.js <path to app> <app_id> <maestro_flow> <jsengine> <flavor> <w
2525
@param {string} deviceOS - Optional Maestro device OS, such as iOS-26-2
2626
@param {string} testStatePath - Optional file used to persist per-flow results between CI retries
2727
@param {string} excludeTags - Optional comma-separated flow tags to exclude
28+
29+
node maestro-ios.js boot [device_model] [device_os]
30+
31+
Starts booting the simulator the tests will run on and returns without
32+
waiting for the boot to finish.
2833
==============
2934
`;
3035

@@ -557,11 +562,24 @@ async function main(args = process.argv.slice(2)) {
557562
console.log('Test finished');
558563
}
559564

565+
// Lets the workflow start the (slow) simulator boot before the rest of the
566+
// setup, instead of waiting for it in the middle of the test step.
567+
function boot(args) {
568+
if (args.length > 2) {
569+
throw new Error(`Invalid number of arguments.\n${usage}`);
570+
}
571+
launchSimulator(findAvailableSimulator(args[0] || null, args[1] || null));
572+
}
573+
560574
if (require.main === module) {
561-
main().catch(error => {
562-
console.error(error);
563-
process.exitCode = 1;
564-
});
575+
const args = process.argv.slice(2);
576+
const command = args[0] === 'boot' ? () => boot(args.slice(1)) : main;
577+
Promise.resolve()
578+
.then(command)
579+
.catch(error => {
580+
console.error(error);
581+
process.exitCode = 1;
582+
});
565583
}
566584

567585
module.exports = {

0 commit comments

Comments
 (0)