Skip to content
Open
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
14 changes: 9 additions & 5 deletions .github/actions/maestro-ios/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ runs:
- name: Installing Maestro
shell: bash
run: export MAESTRO_VERSION=2.6.1; curl -Ls "https://get.maestro.mobile.dev" | bash
- name: Installing Maestro dependencies
shell: bash
run: |
brew tap facebook/fb
brew install facebook/fb/idb-companion
- name: Install sim-remote
uses: software-mansion-labs/argent-cloud-actions/install@v2
- name: Acquire remote simulator
# Logs in with the job's OIDC id token; released in the post step.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to don't work for forked PRs right? We also can't invoke this with pull_request_target as we won't be able to test the code from the user PR then.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like I mentioned in the discussion on the contributors discord, we should be able to checkout the PR head even from the pull_request_target trigger, by passing the ref explicitly to the checkout action, while still running the workflow itself from the PR target.
...but then the build from the fork could access protected scopes (secrets, the OIDC token we create here, or even other OIDC tokens you may have set up), the same goes for the js helper scripts from the E2E flow.
I feel like it should be fine that way, since the only step that has defined access to anything would be the test step (so build cannot exfil any secrets/the token), but you could still try to do something in the maestro tests themselves to get access to Argent Cloud.
Maybe having a maintainer's manual approval for the workflow would be a good way to go about this, so that there's a pair of eyes that can verify there's no attempt to steal the token before the workflow runs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe having a maintainer's manual approval for the workflow would be a good way to go about this, so that there's a pair of eyes that can verify there's no attempt to steal the token before the workflow runs?

I think that the best would be to have something like a @react-native-bot e2e-tests comment that triggers a workflow, running off of target_pull_request which runs the tests. That workflow can then pull the .apk/.ipa from the artifacts of the PR and execute it isnide the remote simulator and report the results.

uses: software-mansion-labs/argent-cloud-actions/acquire@v2
with:
label: react-native-e2e
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
Expand All @@ -57,6 +59,8 @@ runs:
cd ${{ inputs.working-directory }}
yarn start &
sleep 5 # to give metro time to load
- name: Install Maestro shims
uses: software-mansion-labs/argent-cloud-actions/maestro-shims@v2
- name: Run tests
id: run-tests
shell: bash
Expand Down
20 changes: 20 additions & 0 deletions .github/workflow-scripts/maestro-ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,24 @@ function installAppOnSimulator(appPath, udid) {
childProcess.execSync(`xcrun simctl install "${udid}" "${appPath}"`);
}

// A remote simulator's localhost is the remote host, so Metro needs a tunnel.
function exposeMetroToSimulator(udid) {
const simRemote = process.env.SIM_REMOTE_BIN;
if (!simRemote) {
return;
}

console.log('Exposing local Metro port 8081 to the remote simulator');
childProcess.execSync(`"${simRemote}" reverse start "${udid}" 8081`, {
stdio: 'inherit',
});
}

function bringSimulatorInForeground() {
// Nothing to foreground on a remote simulator.
if (process.env.SIM_REMOTE_BIN) {
return;
}
console.log('Bringing simulator in foreground');
childProcess.execSync('open -a simulator');
}
Expand Down Expand Up @@ -266,6 +283,9 @@ async function main(args = process.argv.slice(2)) {
launchSimulator(simulator);
installAppOnSimulator(appPath, simulator.udid);
bringSimulatorInForeground();
if (isDebug) {
exposeMetroToSimulator(simulator.udid);
}
await launchAppOnSimulator(appId, simulator.udid, isDebug);
await executeFlows(appId, simulator.udid, maestroFlow, jsengine);
console.log('Test finished');
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/e2e-ios-rntester.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: E2E iOS RNTester

permissions:
contents: read
id-token: write

on:
workflow_call:
Expand All @@ -16,7 +17,7 @@ on:

jobs:
test:
runs-on: macos-26-large
runs-on: ubuntu-latest
outputs:
status: ${{ steps.report-status.outputs.status }}
strategy:
Expand Down Expand Up @@ -44,8 +45,8 @@ jobs:
app-id: com.meta.RNTester.localDevelopment
maestro-flow: ./packages/rn-tester/.maestro/
flavor: ${{ matrix.flavor }}
device-model: iPhone-17-Pro
device-os: iOS-26-2
device-model: iPhone-18-Pro
device-os: iOS-27-0
- name: Report status
id: report-status
if: ${{ always() && steps.run-tests.outcome == 'failure' }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/e2e-ios-templateapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: E2E iOS Template App

permissions:
contents: read
id-token: write

on:
workflow_call:
Expand All @@ -15,6 +16,7 @@ on:
value: ${{ jobs.report.outputs.status }}

jobs:
# Building needs Xcode; the tests drive a remote simulator from Linux.
build:
runs-on: macos-26-large
strategy:
Expand Down Expand Up @@ -99,7 +101,7 @@ jobs:

test:
needs: build
runs-on: macos-26-large
runs-on: ubuntu-latest
outputs:
status: ${{ steps.report-status.outputs.status }}
strategy:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

permissions:
contents: read
id-token: write

jobs:
set_release_type:
Expand Down
Loading