Repository navigation
183 lines (171 loc) · 6.51 KB
/
Copy pathe2e-ios-templateapp.yml
File metadata and controls
183 lines (171 loc) · 6.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: E2E iOS Template App
permissions:
contents: read
on:
workflow_call:
inputs:
fail-on-error:
type: boolean
default: false
outputs:
status:
description: 'The result of the E2E tests (success or failure)'
value: ${{ jobs.report.outputs.status }}
jobs:
build:
runs-on: macos-26-large
strategy:
fail-fast: false
matrix:
flavor: [Debug, Release]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Run yarn
uses: ./.github/actions/yarn-install
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.10
- name: Download React Native Package
uses: ./.github/actions/download-artifact
with:
name: react-native-package
path: /tmp/react-native-tmp
- name: Print /tmp folder
run: ls -lR /tmp/react-native-tmp
- name: Download ReactNativeDependencies
uses: ./.github/actions/download-artifact
with:
name: ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
path: /tmp/third-party
- name: Print third-party folder
shell: bash
run: ls -lR /tmp/third-party
- name: Download React Native Prebuilds
uses: ./.github/actions/download-artifact
with:
name: ReactCore${{ matrix.flavor }}.xcframework.tar.gz
path: /tmp/ReactCore
- name: Print ReactCore folder
shell: bash
run: ls -lR /tmp/ReactCore
- name: Configure git
shell: bash
run: |
git config --global user.email "react-native-bot@meta.com"
git config --global user.name "React Native Bot"
- name: Build the app
run: |
REACT_NATIVE_PKG=$(find /tmp/react-native-tmp -type f -name "*.tgz")
echo "React Native tgs is $REACT_NATIVE_PKG"
# For stable branches, we want to use the stable branch of the template
# In all the other cases, we want to use "main"
BRANCH=${{ github.ref_name }}
if ! [[ $BRANCH == *-stable* ]]; then
BRANCH=main
fi
node ./scripts/e2e/init-project-e2e.js --projectName RNTestProject --currentBranch $BRANCH --directory /tmp/RNTestProject --pathToLocalReactNative $REACT_NATIVE_PKG
cd /tmp/RNTestProject/ios
bundle install
NEW_ARCH_ENABLED=1
export RCT_USE_LOCAL_RN_DEP=/tmp/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
# Disable prebuilds for now, as they are causing issues with E2E tests for 0.82-stable branch
export RCT_TESTONLY_RNCORE_TARBALL_PATH="/tmp/ReactCore/ReactCore${{ matrix.flavor }}.xcframework.tar.gz"
RCT_NEW_ARCH_ENABLED=$NEW_ARCH_ENABLED bundle exec pod install
xcodebuild \
-scheme "RNTestProject" \
-workspace RNTestProject.xcworkspace \
-configuration "${{ matrix.flavor }}" \
-sdk "iphonesimulator" \
-destination "generic/platform=iOS Simulator" \
-derivedDataPath "/tmp/RNTestProject"
- name: Upload app
uses: ./.github/actions/upload-artifact
with:
name: RNTestProject-${{ matrix.flavor }}
overwrite: true
path: /tmp/RNTestProject/Build/Products/${{ matrix.flavor }}-iphonesimulator/RNTestProject.app
test:
needs: build
runs-on: macos-26-large
outputs:
status: ${{ steps.report-status.outputs.status }}
strategy:
fail-fast: false
matrix:
flavor: [Debug, Release]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Run yarn
uses: ./.github/actions/yarn-install
- name: Download app
uses: ./.github/actions/download-artifact
with:
name: RNTestProject-${{ matrix.flavor }}
path: /tmp/RNTestProjectBuild/RNTestProject.app
- name: Check downloaded folder content
run: ls -l /tmp/RNTestProjectBuild/RNTestProject.app
- name: Download React Native Package
if: ${{ matrix.flavor == 'Debug' }}
uses: ./.github/actions/download-artifact
with:
name: react-native-package
path: /tmp/react-native-tmp
- name: Configure git
if: ${{ matrix.flavor == 'Debug' }}
shell: bash
run: |
git config --global user.email "react-native-bot@meta.com"
git config --global user.name "React Native Bot"
- name: Prepare project for Metro
if: ${{ matrix.flavor == 'Debug' }}
# In Debug the app loads its bundle from Metro, which must run from an
# initialized project. Re-initialize it here (JS only — no pods); the
# native app itself comes prebuilt from the `build` job.
run: |
REACT_NATIVE_PKG=$(find /tmp/react-native-tmp -type f -name "*.tgz")
echo "React Native tgs is $REACT_NATIVE_PKG"
BRANCH=${{ github.ref_name }}
if ! [[ $BRANCH == *-stable* ]]; then
BRANCH=main
fi
node ./scripts/e2e/init-project-e2e.js --projectName RNTestProject --currentBranch $BRANCH --directory /tmp/RNTestProject --pathToLocalReactNative $REACT_NATIVE_PKG
- name: Run E2E Tests
id: run-tests
continue-on-error: true
uses: ./.github/actions/maestro-ios
with:
app-path: '/tmp/RNTestProjectBuild/RNTestProject.app'
app-id: org.reactjs.native.example.RNTestProject
maestro-flow: ./scripts/e2e/.maestro/
flavor: ${{ matrix.flavor }}
working-directory: /tmp/RNTestProject
- name: Report status
id: report-status
if: ${{ always() && steps.run-tests.outcome == 'failure' }}
run: echo "status=failure" >> $GITHUB_OUTPUT
report:
needs: [build, test]
if: always()
runs-on: ubuntu-latest
outputs:
status: ${{ steps.check.outputs.status }}
steps:
- id: check
run: |
if [[ "${{ needs.build.result }}" != "success" ||
"${{ needs.test.result }}" != "success" ||
"${{ needs.test.outputs.status }}" == "failure" ]]; then
echo "status=failure" >> $GITHUB_OUTPUT
else
echo "status=success" >> $GITHUB_OUTPUT
fi
- name: Fail if needed
if: ${{ inputs.fail-on-error && steps.check.outputs.status == 'failure' }}
run: exit 1