-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitrise.yml
377 lines (354 loc) · 11.9 KB
/
bitrise.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
---
format_version: '8'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ios
trigger_map:
- push_branch: "*"
pipeline: pipeline_multiple_shards
- pull_request_source_branch: "*"
pipeline: pipeline_multiple_shards
- tag: "*"
pipeline: pipeline_multiple_shards
pipelines:
pipeline_multiple_shards:
stages:
- stage_1: {}
- stage_2: {}
- stage_3: {}
pipeline_multiple_devices:
stages:
- stage_1b: { }
- stage_2b: { }
- stage_3b: { }
stages:
stage_1:
workflows:
- pipeline_test_shards: {}
stage_2:
workflows:
- tests_1: {}
- tests_2: {}
- tests_3: {}
- tests_4: {}
- tests_5: {}
stage_3:
workflows:
- deploy: {}
stage_1b:
workflows:
- pipeline_multiple_destinations: { }
stage_2b:
workflows:
- test_iPhone_8: { }
- test_iPhone_8_plus: { }
- test_iPhone_11: { }
- test_iPhone_12: { }
- test_iPhone_13: { }
stage_3b:
workflows:
- deploy: { }
workflows:
deploy:
steps:
- git::https://github.com/bitrise-steplib/bitrise-step-artifact-pull.git@main:
title: Pull artifacts
inputs:
- verbose: true
- artifact_sources: stage_2.*
title: Deploy Artifacts
inputs:
- content: |
#!/usr/bin/env bash
set -euxo pipefail
echo "==== MOVE FILES TO DEPLOY DIR ===="
echo "$BITRISE_ARTIFACT_PATHS"
cd /tmp
MYDIR=`pwd`/tmp/Users/vagrant/git/xcodebuild.xcresult
i=1
IFS='|'
read -ra FILES <<< "$BITRISE_ARTIFACT_PATHS"
for f in ${FILES[@]}
do
if [ "${f: -4}" = ".zip" ]; then
echo "Processing $f"
rm -rf tmp
mkdir tmp
unzip "$f" -d tmp
echo "--Trainer--"
mkdir "${BITRISE_TEST_RESULT_DIR}/test_${i}"
trainer --path "${MYDIR}" --output_directory "${BITRISE_TEST_RESULT_DIR}/test_${i}" || : echo "{ \"test-name\": \"Tests ${i}\" }" > "${BITRISE_TEST_RESULT_DIR}/test_${i}/test-info.json"
((i++))
fi
done
- deploy-to-bitrise-io@2: {}
pipeline_test_shards:
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@6: {}
- cocoapods-install@2: {}
- git::https://github.com/DamienBitrise/bitrise-test-plan-sharder.git@master:
title: Bitrise Test Plan Sharder
inputs:
- xcode_project: Notes.xcodeproj
- target: NotesUITests
- shards: '5'
- scheme: Notes
- test_plan: Notes.xctestplan
- debug_mode: 'true'
- test_path: ''
- file_type: ".swift"
title: Build for Testing
inputs:
- content: |+
set -euxo pipefail
echo "-- build-for-testing --"
mkdir DerivedData
xcodebuild \
-scheme "Notes" \
-workspace "Notes.xcworkspace" \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=iPhone 8,OS=latest" \
-derivedDataPath "${BITRISE_SOURCE_DIR}/DerivedData" \
build-for-testing
title: Compress Derived Data
is_always_run: true
inputs:
- content: |
set -euxo pipefail
echo "-- compress --"
exec zip -0 -qr \
"${BITRISE_SOURCE_DIR}/DerivedData.zip" \
"$BITRISE_SOURCE_DIR/DerivedData/Build/Products/Debug-iphonesimulator/Notes.app" \
"$BITRISE_SOURCE_DIR/DerivedData/Build/Products/Debug-iphonesimulator/NotesUITests-Runner.app" \
"$BITRISE_SOURCE_DIR/DerivedData/Build/Products/Notes_Notes_iphonesimulator13.5-x86_64.xctestrun" \
"$BITRISE_SOURCE_DIR/Notes.xcworkspace" \
"$BITRISE_SOURCE_DIR/Notes.xcodeproj" \
"$BITRISE_SOURCE_DIR/Notes.xctestplan" \
"$BITRISE_SOURCE_DIR/TestShard_0.xctestplan" \
"$BITRISE_SOURCE_DIR/TestShard_1.xctestplan" \
"$BITRISE_SOURCE_DIR/TestShard_2.xctestplan" \
"$BITRISE_SOURCE_DIR/TestShard_3.xctestplan" \
"$BITRISE_SOURCE_DIR/TestShard_4.xctestplan"
- deploy-to-bitrise-io@2:
inputs:
- deploy_path: "${BITRISE_SOURCE_DIR}/DerivedData.zip"
pipeline_multiple_destinations:
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@6: { }
- cocoapods-install@2: { }
title: Build for Testing
inputs:
- content: |+
set -euxo pipefail
echo "-- build-for-testing --"
mkdir DerivedData
xcodebuild \
-scheme "Notes" \
-workspace "Notes.xcworkspace" \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=iPhone 8,OS=latest" \
-derivedDataPath "${BITRISE_SOURCE_DIR}/DerivedData" \
build-for-testing
title: Compress Derived Data
is_always_run: true
inputs:
- content: |
set -euxo pipefail
echo "-- compress --"
exec zip -0 -qr \
"${BITRISE_SOURCE_DIR}/DerivedData.zip" \
"$BITRISE_SOURCE_DIR/DerivedData/Build/Products/Debug-iphonesimulator/Notes.app" \
"$BITRISE_SOURCE_DIR/DerivedData/Build/Products/Debug-iphonesimulator/NotesUITests-Runner.app" \
"$BITRISE_SOURCE_DIR/DerivedData/Build/Products/Notes_Notes_iphonesimulator13.5-x86_64.xctestrun" \
"$BITRISE_SOURCE_DIR/Notes.xcworkspace" \
"$BITRISE_SOURCE_DIR/Notes.xcodeproj" \
"$BITRISE_SOURCE_DIR/Notes.xctestplan"
- deploy-to-bitrise-io@2:
inputs:
- deploy_path: "${BITRISE_SOURCE_DIR}/DerivedData.zip"
tests_1:
envs:
- opts:
is_expand: false
SHARD: '1'
after_run:
- _tests
tests_2:
envs:
- opts:
is_expand: false
SHARD: '2'
after_run:
- _tests
tests_3:
envs:
- opts:
is_expand: false
SHARD: '3'
after_run:
- _tests
tests_4:
envs:
- opts:
is_expand: false
SHARD: '4'
after_run:
- _tests
tests_5:
envs:
- opts:
is_expand: false
SHARD: '5'
after_run:
- _tests
_tests:
steps:
- git::https://github.com/bitrise-steplib/bitrise-step-artifact-pull.git@main:
title: Pull artifacts
inputs:
- verbose: true
- artifact_sources: stage_1.*
title: Unzip
inputs:
- content: |
set -euxo pipefail
echo "$BITRISE_ARTIFACT_PATHS"
echo "-- unzip -- "
exec unzip "${BITRISE_ARTIFACT_PATHS}"
title: Test without Building
inputs:
- content: |
#!/usr/bin/env bash
set -ex
ls -la
mv ./Users/vagrant/git/* .
ls -la
rm Notes.xctestplan
cp TestShard_$((SHARD-1)).xctestplan Notes.xctestplan
chmod 644 Notes.xctestplan
echo "-- test-without-building --"
xcodebuild -workspace "Notes.xcworkspace" -scheme "Notes" -sdk iphonesimulator -resultBundlePath "xcodebuild.xcresult" -derivedDataPath "/Users/vagrant/git/DerivedData" -testPlan "Notes" -parallel-testing-enabled YES -maximum-parallel-testing-workers $SIMS -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" test-without-building
title: Compress Result Bundle
is_always_run: true
inputs:
- content: |-
set -euxo pipefail
echo "-- compress --"
cd "${BITRISE_DEPLOY_DIR}/"
exec zip -qr "${BITRISE_DEPLOY_DIR}/TestResults${SHARD}.zip" "/Users/vagrant/git/xcodebuild.xcresult"
- deploy-to-bitrise-io@2: { }
test_iPhone_8:
envs:
- opts:
is_expand: false
SHARD: '1'
- opts:
is_expand: false
SIMULATOR: 'iPhone 8'
after_run:
- _multiple_destination_tests
test_iPhone_8_plus:
envs:
- opts:
is_expand: false
SHARD: '2'
- opts:
is_expand: false
SIMULATOR: 'iPhone 8 Plus'
after_run:
- _multiple_destination_tests
test_iPhone_11:
envs:
- opts:
is_expand: false
SHARD: '2'
- opts:
is_expand: false
SIMULATOR: 'iPhone 11'
after_run:
- _multiple_destination_tests
test_iPhone_12:
envs:
- opts:
is_expand: false
SHARD: '2'
- opts:
is_expand: false
SIMULATOR: 'iPhone 11'
after_run:
- _multiple_destination_tests
test_iPhone_13:
envs:
- opts:
is_expand: false
SHARD: '5'
- opts:
is_expand: false
SIMULATOR: 'iPhone 13'
after_run:
- _multiple_destination_tests
_multiple_destination_tests:
steps:
- git::https://github.com/bitrise-steplib/bitrise-step-artifact-pull.git@main:
title: Pull artifacts
inputs:
- verbose: true
- artifact_sources: stage_1.*
title: Unzip
inputs:
- content: |
set -euxo pipefail
echo "$BITRISE_ARTIFACT_PATHS"
echo "-- unzip -- "
exec unzip "${BITRISE_ARTIFACT_PATHS}"
title: Test without Building
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
ls -la
mv ./Users/vagrant/git/* .
ls -la
echo "-- test-without-building --"
xcodebuild -workspace "Notes.xcworkspace" -scheme "Notes" -sdk iphonesimulator -resultBundlePath "xcodebuild.xcresult" -derivedDataPath "/Users/vagrant/git/DerivedData" -parallel-testing-enabled YES -maximum-parallel-testing-workers $SIMS -destination "platform=iOS Simulator,name=${SIMULATOR},OS=latest" -retry-tests-on-failure test-without-building
title: Compress Result Bundle
is_always_run: true
inputs:
- content: |-
set -euxo pipefail
echo "-- compress --"
cd "${BITRISE_DEPLOY_DIR}/"
exec zip -qr "${BITRISE_DEPLOY_DIR}/TestResults${SHARD}.zip" "/Users/vagrant/git/xcodebuild.xcresult"
- deploy-to-bitrise-io@2: { }
app:
envs:
- opts:
is_expand: false
BITRISE_PROJECT_PATH: Notes.xcworkspace
- opts:
is_expand: false
BITRISE_SCHEME: Notes
- opts:
is_expand: false
BITRISE_EXPORT_METHOD: development
- opts:
is_expand: false
SIMS: '2'
meta:
bitrise.io:
stack: osx-xcode-13.1.x
machine_type_id: standard