Skip to content

Commit 3fbd3d7

Browse files
committed
Add Maestro Cloud workflow for fork PRs
1 parent fd10410 commit 3fbd3d7

2 files changed

Lines changed: 159 additions & 0 deletions

File tree

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: Maestro Cloud
2+
3+
on:
4+
workflow_run:
5+
workflows: [Test All]
6+
types: [completed]
7+
8+
permissions:
9+
actions: read
10+
contents: read
11+
12+
concurrency:
13+
group: maestro-cloud-${{ github.event.workflow_run.head_repository.full_name }}-${{ github.event.workflow_run.head_branch }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
find-artifacts:
18+
name: Find RNTester artifacts
19+
if: |
20+
github.event.workflow_run.event == 'pull_request' &&
21+
github.event.workflow_run.conclusion != 'cancelled'
22+
runs-on: ubuntu-latest
23+
outputs:
24+
android: ${{ steps.artifacts.outputs.android }}
25+
ios: ${{ steps.artifacts.outputs.ios }}
26+
workspace: ${{ steps.artifacts.outputs.workspace }}
27+
steps:
28+
- name: Check available artifacts
29+
id: artifacts
30+
env:
31+
GH_TOKEN: ${{ github.token }}
32+
REPOSITORY: ${{ github.repository }}
33+
RUN_ID: ${{ github.event.workflow_run.id }}
34+
run: |
35+
ARTIFACTS=$(gh api \
36+
--paginate \
37+
"/repos/$REPOSITORY/actions/runs/$RUN_ID/artifacts" \
38+
--jq '.artifacts[] | select(.expired == false) | .name')
39+
40+
for artifact in \
41+
rntester-release \
42+
RNTesterApp-NewArch-Release \
43+
rntester-maestro-workspace; do
44+
if grep -Fxq "$artifact" <<< "$ARTIFACTS"; then
45+
case "$artifact" in
46+
rntester-release) echo "android=true" >> "$GITHUB_OUTPUT" ;;
47+
RNTesterApp-NewArch-Release) echo "ios=true" >> "$GITHUB_OUTPUT" ;;
48+
rntester-maestro-workspace) echo "workspace=true" >> "$GITHUB_OUTPUT" ;;
49+
esac
50+
fi
51+
done
52+
53+
android:
54+
name: RNTester Android
55+
needs: find-artifacts
56+
if: |
57+
needs.find-artifacts.outputs.android == 'true' &&
58+
needs.find-artifacts.outputs.workspace == 'true'
59+
runs-on: ubuntu-latest
60+
timeout-minutes: 75
61+
environment: maestro-cloud
62+
steps:
63+
- name: Download RNTester APK
64+
uses: actions/download-artifact@v7
65+
with:
66+
name: rntester-release
67+
path: /tmp/rntester-android
68+
repository: ${{ github.repository }}
69+
run-id: ${{ github.event.workflow_run.id }}
70+
github-token: ${{ github.token }}
71+
- name: Download Maestro workspace
72+
uses: actions/download-artifact@v7
73+
with:
74+
name: rntester-maestro-workspace
75+
path: /tmp/rntester-maestro
76+
repository: ${{ github.repository }}
77+
run-id: ${{ github.event.workflow_run.id }}
78+
github-token: ${{ github.token }}
79+
- name: Validate inputs
80+
env:
81+
MAESTRO_CLOUD_API_KEY: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
82+
MAESTRO_CLOUD_PROJECT_ID: ${{ vars.MAESTRO_CLOUD_PROJECT_ID }}
83+
run: |
84+
test -n "$MAESTRO_CLOUD_API_KEY"
85+
test -n "$MAESTRO_CLOUD_PROJECT_ID"
86+
test -f /tmp/rntester-android/app-x86-release.apk
87+
test -z "$(find /tmp/rntester-maestro -type l -print -quit)"
88+
- name: Run flows on Maestro Cloud
89+
uses: mobile-dev-inc/action-maestro-cloud@5759506b4ec7ee0a1ece4b7e6574bba2b282f241 # v3.0.1
90+
with:
91+
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
92+
project-id: ${{ vars.MAESTRO_CLOUD_PROJECT_ID }}
93+
app-file: /tmp/rntester-android/app-x86-release.apk
94+
workspace: /tmp/rntester-maestro
95+
branch: ${{ github.event.workflow_run.head_branch }}
96+
name: RNTester Android - ${{ github.event.workflow_run.display_title }}
97+
env: |
98+
APP_ID=com.facebook.react.uiapp
99+
maestro-cli-version: 2.6.1
100+
timeout: 60
101+
102+
ios:
103+
name: RNTester iOS
104+
needs: find-artifacts
105+
if: |
106+
needs.find-artifacts.outputs.ios == 'true' &&
107+
needs.find-artifacts.outputs.workspace == 'true'
108+
runs-on: ubuntu-latest
109+
timeout-minutes: 75
110+
environment: maestro-cloud
111+
steps:
112+
- name: Download RNTester app
113+
uses: actions/download-artifact@v7
114+
with:
115+
name: RNTesterApp-NewArch-Release
116+
path: /tmp/RNTesterBuild/RNTester.app
117+
repository: ${{ github.repository }}
118+
run-id: ${{ github.event.workflow_run.id }}
119+
github-token: ${{ github.token }}
120+
- name: Download Maestro workspace
121+
uses: actions/download-artifact@v7
122+
with:
123+
name: rntester-maestro-workspace
124+
path: /tmp/rntester-maestro
125+
repository: ${{ github.repository }}
126+
run-id: ${{ github.event.workflow_run.id }}
127+
github-token: ${{ github.token }}
128+
- name: Validate inputs
129+
env:
130+
MAESTRO_CLOUD_API_KEY: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
131+
MAESTRO_CLOUD_PROJECT_ID: ${{ vars.MAESTRO_CLOUD_PROJECT_ID }}
132+
run: |
133+
test -n "$MAESTRO_CLOUD_API_KEY"
134+
test -n "$MAESTRO_CLOUD_PROJECT_ID"
135+
test -d /tmp/RNTesterBuild/RNTester.app
136+
test -z "$(find /tmp/rntester-maestro -type l -print -quit)"
137+
- name: Run flows on Maestro Cloud
138+
uses: mobile-dev-inc/action-maestro-cloud@5759506b4ec7ee0a1ece4b7e6574bba2b282f241 # v3.0.1
139+
with:
140+
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
141+
project-id: ${{ vars.MAESTRO_CLOUD_PROJECT_ID }}
142+
app-file: /tmp/RNTesterBuild/RNTester.app
143+
workspace: /tmp/rntester-maestro
144+
branch: ${{ github.event.workflow_run.head_branch }}
145+
name: RNTester iOS - ${{ github.event.workflow_run.display_title }}
146+
exclude-tags: android-only
147+
env: |
148+
APP_ID=com.meta.RNTester.localDevelopment
149+
maestro-cli-version: 2.6.1
150+
timeout: 60

.github/workflows/test-all.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ jobs:
8888
debugger_shell:
8989
- 'packages/debugger-shell/**'
9090
- 'scripts/debugger-shell/**'
91+
- name: Upload RNTester Maestro workspace
92+
if: github.event_name == 'pull_request'
93+
uses: actions/upload-artifact@v6
94+
with:
95+
name: rntester-maestro-workspace
96+
path: packages/rn-tester/.maestro/
97+
include-hidden-files: true
98+
if-no-files-found: error
99+
retention-days: 7
91100

92101
prebuild_apple_dependencies:
93102
needs: check_code_changes

0 commit comments

Comments
 (0)