-
Notifications
You must be signed in to change notification settings - Fork 15
382 lines (346 loc) Β· 21.3 KB
/
_reusable_run_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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
on:
workflow_call:
inputs:
wire-ios:
type: boolean
default: false
required: false
wire-ios-sync-engine:
type: boolean
default: false
required: false
wire-ios-data-model:
type: boolean
default: false
required: false
wire-ios-system:
type: boolean
default: false
required: false
wire-ios-request-strategy:
type: boolean
default: false
required: false
wire-api:
type: boolean
default: false
required: false
wire-domain:
type: boolean
default: false
required: false
wire-ios-transport:
type: boolean
default: false
required: false
wire-ios-share-engine:
type: boolean
default: false
required: false
wire-ios-cryptobox:
type: boolean
default: false
required: false
wire-ios-mocktransport:
type: boolean
default: false
required: false
wire-ios-notification-engine:
type: boolean
default: false
required: false
wire-ios-protos:
type: boolean
default: false
required: false
wire-ios-images:
type: boolean
default: false
required: false
wire-ios-link-preview:
type: boolean
default: false
required: false
wire-ios-utilities:
type: boolean
default: false
required: false
wire-ios-testing:
type: boolean
default: false
required: false
all:
type: boolean
default: false
required: false
secrets:
ZENKINS_USERNAME:
required: true
DD_API_KEY:
required: true
env: # https://docs.fastlane.tools/getting-started/ios/setup/
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
jobs:
run-tests:
runs-on: ghcr.io/cirruslabs/macos-runner:sonoma
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ secrets.ZENKINS_USERNAME }}
SLACK_WEBHOOK_URL: ${{ secrets.WIRE_IOS_CI_WEBHOOK }}
steps:
- uses: actions/checkout@v3
- name: Retrieve Xcode version
run: |
echo "XCODE_VERSION=$(cat .xcode-version)" >> $GITHUB_OUTPUT
id: xcode-version
- uses: maxim-lobanov/[email protected]
with:
xcode-version: ${{ steps.xcode-version.outputs.XCODE_VERSION }}
- name: Load .env file
uses: xom9ikk/dotenv@v2
with:
path: fastlane/
- name: Restore Carthage Cache
uses: actions/cache@v3
id: cache-carthage
with:
path: Carthage
key: ${{ runner.os }}-xcode${{ steps.xcode-version.outputs.XCODE_VERSION }}-carthage-${{ hashFiles('Cartfile.resolved') }}
- name: Bootstrap Carthage if no cache
if: steps.cache-carthage.outputs.cache-hit != 'true'
run: ./scripts/carthage.sh bootstrap --platform ios --use-xcframeworks
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Setup workspace
run: |
./setup.sh
- name: Setup simulator
run: |
bundle exec fastlane prepare_for_tests
- name: Test WireSystem
if: ${{ inputs.wire-ios-system || inputs.all }}
run: |
echo "WireSystem has changes"
echo "Building WireSystem..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireSystem -resultBundlePath xcodebuild-wire-ios-system -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-system.log | bundle exec xcpretty
echo "Testing WireSystem..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireSystem -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-system.log | bundle exec xcpretty --report junit --output build/reports/WireSystem.junit
exit ${PIPESTATUS[0]}
- uses: hoangapvn/analyze-xcoderesults-action
if: ${{ inputs.wire-ios-system || inputs.all }}
with:
results: xcodebuild-wire-ios-system.xcresult
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test WireTesting
if: ${{ inputs.wire-ios-testing || inputs.all }}
run: |
echo "WireTesting has changes"
echo "Building WireTesting..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireTesting -resultBundlePath xcodebuild-wire-ios-testing -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-testing.log | bundle exec xcpretty
echo "Testing WireTesting..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireTesting -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-testing.log | bundle exec xcpretty --report junit --output build/reports/WireTesting.junit
exit ${PIPESTATUS[0]}
- name: Test WireUtilities
if: ${{ inputs.wire-ios-utilities || inputs.all }}
run: |
echo "WireUtilities has changes"
echo "Building WireUtilities..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireUtilities -resultBundlePath xcodebuild-wire-ios-utilities -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-utilities.log | bundle exec xcpretty
echo "Testing WireUtilities..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireUtilities -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-utilities.log | bundle exec xcpretty --report junit --output build/reports/WireUtilities.junit
exit ${PIPESTATUS[0]}
- name: Test WireCryptobox
if: ${{ inputs.wire-ios-cryptobox || inputs.all }}
run: |
echo "WireCryptobox has changes"
echo "Building WireCryptobox..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireCryptobox -resultBundlePath xcodebuild-wire-ios-cryptobox -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-cryptobox.log | bundle exec xcpretty
echo "Testing WireCryptobox..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireCryptobox -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-cryptobox.log | bundle exec xcpretty --report junit --output build/reports/WireCryptobox.junit
exit ${PIPESTATUS[0]}
- name: Test WireTransport
if: ${{ inputs.wire-ios-transport || inputs.all }}
run: |
echo "WireTransport has changes"
echo "Building WireTransport..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireTransport -resultBundlePath xcodebuild-wire-ios-transport -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-transport.log | bundle exec xcpretty
echo "Testing WireTransport..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireTransport -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-transport.log | bundle exec xcpretty --report junit --output build/reports/WireTransport.junit
exit ${PIPESTATUS[0]}
- name: Test WireLinkPreview
if: ${{ inputs.wire-ios-link-preview || inputs.all }}
run: |
echo "WireLinkPreview has changes"
echo "Building WireLinkPreview..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireLinkPreview -resultBundlePath xcodebuild-wire-ios-link-preview -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-link-preview.log | bundle exec xcpretty
echo "Testing WireLinkPreview..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireLinkPreview -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-link-preview.log | bundle exec xcpretty --report junit --output build/reports/WireLinkPreview.junit
exit ${PIPESTATUS[0]}
- name: Test WireImages
if: ${{ inputs.wire-ios-images || inputs.all }}
run: |
echo "WireImages has changes"
echo "Building WireImages..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireImages -resultBundlePath xcodebuild-wire-ios-images -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-images.log | bundle exec xcpretty
echo "Testing WireImages..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireImages -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-images.log | bundle exec xcpretty --report junit --output build/reports/WireImages.junit
exit ${PIPESTATUS[0]}
- name: Test WireProtos
if: ${{ inputs.wire-ios-protos || inputs.all }}
run: |
echo "WireProtos has changes"
echo "Building WireProtos..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireProtos -resultBundlePath xcodebuild-wire-ios-protos -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-protos.log | bundle exec xcpretty
echo "Testing WireProtos..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireProtos -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-protos.log | bundle exec xcpretty
exit ${PIPESTATUS[0]}
- name: Test WireMockTransport
if: ${{ inputs.wire-ios-mocktransport || inputs.all }}
run: |
echo "WireMockTransport has changes"
echo "Building WireMockTransport..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireMockTransport -resultBundlePath xcodebuild-wire-ios-mocktransport -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-mocktransport.log | bundle exec xcpretty
echo "Testing WireMockTransport..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireMockTransport -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-mocktransport.log | bundle exec xcpretty --report junit --output build/reports/WireMockTransport.junit
exit ${PIPESTATUS[0]}
- name: Test WireDataModel
if: ${{ inputs.wire-ios-data-model || inputs.all }}
run: |
echo "WireDataModel has changes"
echo "Building WireDataModel..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireDataModel -resultBundlePath xcodebuild-wire-ios-data-model -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-data-model.log | bundle exec xcpretty
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireDataModel -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-data-model.log | bundle exec xcpretty --report junit --output build/reports/WireDataModel.junit
exit ${PIPESTATUS[0]}
- name: Test WireAPI
if: ${{ inputs.wire-api || inputs.all }}
run: |
echo "WireAPI has changes"
echo "Building WireAPI..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireAPI -resultBundlePath xcodebuild-wire-api -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-api.log | bundle exec xcpretty
echo "Testing WireAPI..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireAPI -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-api.log | bundle exec xcpretty --report junit --output build/reports/WireAPI.junit
exit ${PIPESTATUS[0]}
- name: Test WireDomain
if: ${{ inputs.wire-domain || inputs.all }}
run: |
echo "WireDomain has changes"
echo "Building WireDomain..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireDomain -resultBundlePath xcodebuild-wire-domain -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-domain.log | bundle exec xcpretty
echo "Testing WireDomain..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireDomain -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-domain.log | bundle exec xcpretty --report junit --output build/reports/WireDomain.junit
exit ${PIPESTATUS[0]}
- name: Test WireRequestStrategy
if: ${{ inputs.wire-ios-request-strategy || inputs.all }}
run: |
echo "WireRequestStrategy has changes"
echo "Building WireRequestStrategy..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireRequestStrategy -resultBundlePath xcodebuild-wire-ios-request-strategy -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-request-strategy.log | bundle exec xcpretty
echo "Testing WireRequestStrategy..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireRequestStrategy -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-request-strategy.log | bundle exec xcpretty --report junit --output build/reports/WireRequestStrategy.junit
exit ${PIPESTATUS[0]}
- name: Test WireShareEngine
if: ${{ inputs.wire-ios-share-engine || inputs.all }}
run: |
echo "WireShareEngine has changes"
echo "Building WireShareEngine..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireShareEngine -resultBundlePath xcodebuild-wire-ios-share-engine -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-share-engine.log | bundle exec xcpretty
echo "Testing WireShareEngine..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireShareEngine -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-share-engine.log | bundle exec xcpretty --report junit --output build/reports/WireShareEngine.junit
exit ${PIPESTATUS[0]}
- name: Test WireSyncEngine
if: ${{ inputs.wire-ios-sync-engine || inputs.all }}
run: |
echo "WireSyncEngine has changes"
echo "Building WireSyncEngine..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireSyncEngine -resultBundlePath xcodebuild-wire-ios-sync-engine -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-sync-engine.log | bundle exec xcpretty
echo "Testing WireSyncEngine..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireSyncEngine -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-sync-engine.log | bundle exec xcpretty --report junit --output build/reports/WireSyncEngine.junit
exit ${PIPESTATUS[0]}
- name: Test Wire-iOS
if: ${{ inputs.wire-ios || inputs.all }}
run: |
echo "Wire-iOS has changes"
echo "Building Wire-iOS..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme Wire-iOS -resultBundlePath xcodebuild-wire-ios -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios.log | bundle exec xcpretty
echo "Testing Wire-iOS..."
xcodebuild test -workspace wire-ios-mono.xcworkspace -scheme Wire-iOS -testPlan AllTests -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios.log | bundle exec xcpretty --report junit --output build/reports/Wire-iOS-EN.junit
exit ${PIPESTATUS[0]}
- name: Test Wire-iOS German Locale Tests
if: ${{ inputs.wire-ios || inputs.all }}
run: |
echo "Testing Wire-iOS German Locale Tests..."
xcodebuild test -workspace wire-ios-mono.xcworkspace -scheme Wire-iOS -testPlan GermanLocaleTests -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-de.log | bundle exec xcpretty --report junit --output build/reports/Wire-iOS-DE.junit
exit ${PIPESTATUS[0]}
- name: Upload Failed snapshots
uses: actions/upload-artifact@v3
if: always()
with:
name: Failed Snapshots and log
path: |
wire-ios/SnapshotResults/
xcodebuild*.log
# WORKAROUND: if we test WireNotificationEngine and then Wire-iOS, we'll get an error when trying to build
# Wire-iOS stating that symbols from the notification can't be found. to workaround this, test the notification
# after the Wire-iOS.
- name: Test WireNotificationEngine
if: ${{ inputs.wire-ios-notification-engine || inputs.all }}
run: |
echo "WireNotificationEngine has changes"
echo "Building WireNotificationEngine..."
xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireNotificationEngine -resultBundlePath xcodebuild-wire-ios-notification-engine -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-notification-engine.log | bundle exec xcpretty
echo "Testing WireNotificationEngine..."
xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireNotificationEngine -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-notification-engine.log | bundle exec xcpretty --report junit --output build/reports/WireNotificationEngine.junit
exit ${PIPESTATUS[0]}
- name: Upload Test Reports as Artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: test-reports
path: |
build/reports/*.junit
- name: Prepare visual representation of test results
uses: EnricoMi/publish-unit-test-result-action/macos@v2
if: always()
with:
files: |
build/reports/*.junit
compare_to_earlier_commit: false
- name: Archiving DerivedData Logs
uses: actions/upload-artifact@v2
if: always()
with:
name: derived-data-xcode
path: |
/Users/runner/Library/Developer/Xcode/DerivedData/**/Logs/**
~/Library/Logs/DiagnosticReports/**
- name: Notify on Wire if failed
if: ${{ failure() && github.ref_name == 'develop' }}
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: "π Tests for 'develop' failed π\ncommit: https://github.com/wireapp/wire-ios-mono/commit/${{ github.sha }}\n**Triggered by:** ${{ github.triggering_actor }}\n**Build log:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\n"
upload-test-results-datadadog:
runs-on: ubuntu-latest
needs: run-tests
if: always()
steps:
- name: Download tests results
uses: actions/download-artifact@v3
continue-on-error: true
with:
name: test-reports
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install datadog-ci
run: npm install -g @datadog/datadog-ci
- name: "Upload results"
env:
DATADOG_API_KEY: ${{ secrets.DD_API_KEY }}
DD_ENV: ci
DATADOG_SITE: datadoghq.eu
run: |
find . -name "*.junit" -type f | tr '\n' ' ' | xargs -L 1 datadog-ci junit upload --service wire-ios-mono .