-
Notifications
You must be signed in to change notification settings - Fork 2.9k
288 lines (283 loc) · 12.2 KB
/
firefox-ios-ui-tests.yml
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
name: "Firefox UI Tests"
on:
workflow_dispatch: {}
schedule:
- cron: "0 2 * * *"
env:
browser: firefox-ios
xcode_version: 15.4
ios_version: 17.5
ios_simulator_default: iPhone 15
xcodebuild_scheme: Fennec
xcodebuild_target: Client
test_results_directory: /Users/runner/tmp
jobs:
compile:
name: Compile
runs-on: macos-14
steps:
- name: Check out source code
uses: actions/checkout@v4.1.7
- name: Setup Xcode
id: xcode
run: |
sudo rm -rf /Applications/Xcode.app
sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer
xcodebuild -version
./checkout.sh
./bootstrap.sh --force
- name: Compile source code
id: compile
run: |
xcodebuild \
-resolvePackageDependencies \
-onlyUsePackageVersionsFromResolvedFile
xcodebuild \
build-for-testing \
-scheme ${{ env.xcodebuild_scheme }} \
-target ${{ env.xcodebuild_target }} \
-derivedDataPath ~/DerivedData \
-destination 'platform=iOS Simulator,name=${{ env.ios_simulator_default }},OS=${{ env.ios_version }}' \
COMPILER_INDEX_STORE_ENABLE=NO CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO ARCHS="arm64"
working-directory: ${{ env.browser }}
- name: Compress Derived Data
id: compress-dd
run: |
tar czf derived-data.tar.gz ~/DerivedData/Build/Products
- name: Save Derived Data
id: upload-derived-data
uses: actions/upload-artifact@v4.3.4
with:
name: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}
path: ./derived-data.tar.gz
retention-days: 2
run-smoketests:
name: Run smoke tests
runs-on: macos-14
needs: compile
strategy:
fail-fast: false
matrix:
ios_simulator: ['iPhone 15 Plus', 'iPad Pro 13-inch (M4)']
steps:
- name: Check out source code
uses: actions/checkout@v4.1.7
- name: Install packages
id: packages
run: |
gem install xcpretty -v 0.3.0
pip install blockkit==1.9.1
npm install -g junit-report-merger@7.0.0
- name: Setup Xcode
id: xcode
run: |
sudo rm -rf /Applications/Xcode.app
sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer
xcodebuild -version
./checkout.sh
./bootstrap.sh --force
- name: Get derived data
id: download-derived-data
uses: actions/download-artifact@v4
with:
name: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}
- name: Decompress derived data
id: decompress-dd
run: |
tar xzf derived-data.tar.gz -C /
- name: Run Smoketest1
id: run-smoketest1
run: |
xcodebuild \
test-without-building \
-scheme ${{ env.xcodebuild_scheme }} \
-target ${{ env.xcodebuild_target }} \
-derivedDataPath ~/DerivedData \
-destination 'platform=iOS Simulator,name=${{ matrix.ios_simulator }},OS=${{ env.ios_version }}' \
-testPlan Smoketest1 \
-resultBundlePath ${{ env.test_results_directory }}/results-smoketest1 \
| tee xcodebuild-smoketest1.log | xcpretty -r junit --output ./junit-smoketest1.xml && exit ${PIPESTATUS[0]}
working-directory: ${{ env.browser }}
continue-on-error: true
- name: Run Smoketest2
id: run-smoketest2
run: |
xcodebuild \
test-without-building \
-scheme ${{ env.xcodebuild_scheme }} \
-target ${{ env.xcodebuild_target }} \
-derivedDataPath ~/DerivedData \
-destination 'platform=iOS Simulator,name=${{ matrix.ios_simulator }},OS=${{ env.ios_version }}' \
-testPlan Smoketest2 \
-resultBundlePath ${{ env.test_results_directory }}/results-smoketest2 \
| tee xcodebuild-smoketest2.log | xcpretty -r junit --output ./junit-smoketest2.xml && exit ${PIPESTATUS[0]}
working-directory: ${{ env.browser }}
continue-on-error: true
- name: Run Smoketest3
id: run-smoketest3
run: |
xcodebuild \
test-without-building \
-scheme ${{ env.xcodebuild_scheme }} \
-target ${{ env.xcodebuild_target }} \
-derivedDataPath ~/DerivedData \
-destination 'platform=iOS Simulator,name=${{ matrix.ios_simulator }},OS=${{ env.ios_version }}' \
-testPlan Smoketest3 \
-resultBundlePath ${{ env.test_results_directory }}/results-smoketest3 \
| tee xcodebuild-smoketest3.log | xcpretty -r junit --output ./junit-smoketest3.xml && exit ${PIPESTATUS[0]}
working-directory: ${{ env.browser }}
continue-on-error: true
- name: Run Smoketest4
id: run-smoketest4
run: |
xcodebuild \
test-without-building \
-scheme ${{ env.xcodebuild_scheme }} \
-target ${{ env.xcodebuild_target }} \
-derivedDataPath ~/DerivedData \
-destination 'platform=iOS Simulator,name=${{ matrix.ios_simulator }},OS=${{ env.ios_version }}' \
-testPlan Smoketest4 \
-resultBundlePath ${{ env.test_results_directory }}/results-smoketest4 \
| tee xcodebuild-smoketest4.log | xcpretty -r junit --output ./junit-smoketest4.xml && exit ${PIPESTATUS[0]}
working-directory: ${{ env.browser }}
continue-on-error: true
- name: Determine pass/fail status
id: passfail
run: |
echo "Smoketest1 status: "${{ steps.run-smoketest1.outcome }}
echo "Smoketest2 status: "${{ steps.run-smoketest2.outcome }}
echo "Smoketest3 status: "${{ steps.run-smoketest3.outcome }}
echo "Smoketest4 status: "${{ steps.run-smoketest4.outcome }}
if [[ ${{ steps.run-smoketest1.outcome }} != 'success'
|| ${{ steps.run-smoketest2.outcome }} != 'success'
|| ${{ steps.run-smoketest3.outcome }} != 'success'
|| ${{ steps.run-smoketest4.outcome }} != 'success' ]]; then
exit 1
else
exit 0
fi
continue-on-error: true
- name: Print test report
id: test-report
run: |
jrm combined.xml junit-*.xml
python ../test-fixtures/ci/convert_junit_to_markdown.py --smoke --github --${{ env.browser }} ./combined.xml ./github.md
cat github.md >> $GITHUB_STEP_SUMMARY
python ../test-fixtures/ci/convert_junit_to_markdown.py --smoke --slack --${{ env.browser }} ./combined.xml ./slack.json
mv ./combined.xml "junit-smoketests-${{ matrix.ios_simulator }}-`date +"%Y-%m-%d"`.xml"
working-directory: ${{ env.browser }}
- name: Upload junit files
id: upload-junit
uses: actions/upload-artifact@v4.3.3
with:
name: ${{ env.browser }}-smoketests-${{ matrix.ios_simulator }}-junit-${{ github.run_number }}
path: ${{ env.browser }}/junit-smoketests-*.xml
retention-days: 90
- name: Upload log file
id: upload-log
uses: actions/upload-artifact@v4.3.3
with:
name: ${{ env.browser }}-smoketests-${{ matrix.ios_simulator }}-xcodebuildlog-${{ github.run_number }}
path: ${{ env.browser }}/xcodebuild-smoketest*.log
retention-days: 90
- name: Report to Slack
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
payload-file-path: ${{ env.browser }}/slack.json
env:
SLACK_WEBHOOK_URL: ${{ secrets.WEBHOOK_SLACK_TOKEN }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
ios_simulator: ${{ matrix.ios_simulator }}
pass_fail: ${{ steps.passfail.outcome == 'success' && ':white_check_mark:' || ':x:' }}
xcodebuild_test_plan: Smoketests
ref_name: ${{ github.ref_name }}
repository: ${{ github.repository }}
run_id: ${{ github.run_id }}
server_url: ${{ github.server_url }}
sha: ${{ github.sha }}
- name: Return fail status if a test fails
run: |
exit ${{ steps.passfail.outcome == 'success' && '0' || '1' }}
run-fullfunctionaltests:
name: Run full functional tests
runs-on: macos-14
needs: run-smoketests
if: false
strategy:
fail-fast: false
matrix:
ios_simulator: ['iPhone 15 Pro Max', 'iPad Pro (12.9 inch) (6th generation)']
steps:
- name: Check out source code
uses: actions/checkout@v4.1.7
- name: Install packages
id: packages
run: |
gem install xcpretty -v 0.3.0
pip install blockkit==1.9.1
- name: Get derived data
id: download-derived-data
uses: actions/download-artifact@v4
with:
name: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}
- name: Decompress derived data
id: decompress-dd
run: |
tar xzf derived-data.tar.gz -C /
- name: Run tests
id: run-tests
run: |
xcrun simctl boot '${{ matrix.ios_simulator }}'
xcodebuild \
test-without-building \
-scheme ${{ env.xcodebuild_scheme }} \
-target ${{ env.xcodebuild_target }} \
-derivedDataPath ~/DerivedData \
-destination 'platform=iOS Simulator,name=${{ matrix.ios_simulator }},OS=${{ env.ios_version }}' \
-testPlan FullFunctionalTestPlan \
-resultBundlePath ${{ env.test_results_directory }}/results \
| tee xcodebuild.log | xcpretty -r junit && exit ${PIPESTATUS[0]}
working-directory: ${{ env.browser }}
continue-on-error: true
- name: Print test report
id: test-report
run: |
python ../test-fixtures/ci/convert_junit_to_markdown.py --github --${{ env.browser }} ./build/reports/junit.xml ./github.md
cat github.md >> $GITHUB_STEP_SUMMARY
python ../test-fixtures/ci/convert_junit_to_markdown.py --slack --${{ env.browser }} ./build/reports/junit.xml ./slack.json
mv ./build/reports/junit.xml "junit-fullfunctional-${{ matrix.ios_simulator }}-`date +"%Y-%m-%d"`.xml"
working-directory: ${{ env.browser }}
- name: Upload junit files
id: upload-junit
uses: actions/upload-artifact@v4.3.3
with:
name: ${{ env.browser }}-fullfunctional-${{ matrix.ios_simulator }}-junit-${{ github.run_number }}
path: ${{ env.browser }}/junit-*.xml
retention-days: 90
- name: Upload log file
id: upload-log
uses: actions/upload-artifact@v4.3.3
with:
name: ${{ env.browser }}-fullfunctional-${{ matrix.ios_simulator }}-xcodebuildlog-${{ github.run_number }}
path: ${{ env.browser }}/xcodebuild.log
retention-days: 90
- name: Report to Slack
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
payload-file-path: ${{ env.browser }}/slack.json
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
ios_simulator: ${{ matrix.ios_simulator }}
pass_fail: ${{ steps.run-tests.outcome == 'success' && ':white_check_mark:' || ':x:' }}
xcodebuild_test_plan: FullFunctionalTestPlan
ref_name: ${{ github.ref_name }}
repository: ${{ github.repository }}
run_id: ${{ github.run_id }}
server_url: ${{ github.server_url }}
sha: ${{ github.sha }}
- name: Return fail status if a test fails
run: |
exit ${{ steps.run-tests.outcome == 'success' && '0' || '1' }}