-
Notifications
You must be signed in to change notification settings - Fork 8
/
bitrise.yml
484 lines (430 loc) · 15.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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
---
format_version: '8'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ios
trigger_map:
- pull_request_target_branch: '*'
pipeline: build-test-pipeline
pipelines:
# Will create a build to test across multiple simulator devices
build-test-pipeline:
stages:
# Build a test build in parallel
- test-build: {}
# Run multiple tests on simulators in parallel
- run-test-groups: {}
- deploy-test-results: {}
# Build a debug build
- debug-build: {}
test-nightly-pipeline:
stages:
# Build a test build
- test-build: {}
# Run multiple tests on simulators in parallel
- run-test-groups-nightly: {}
- deploy-test-results-nightly: {}
# Will create an app store capabale build, but release it to Internal Testing users in Testflight.
# Intended to run nightly.
nightly-internal-pipeline:
stages:
# First Build the release build (app store build)
- release-build: {}
# Run the steps to deploy to testflight internally
- deploy-internal-testflight: {}
stages:
test-build:
workflows:
# Build a test build
- test-build: {}
release-build:
workflows:
# Build a release build
- release-build: {}
debug-build:
workflows:
- debug-build: {}
run-test-groups:
workflows:
- run-tests-unit: {}
- run-tests-ui-1: {}
- run-tests-ui-2: {}
- run-tests-ui-3: {}
- run-tests-ui-4: {}
run-test-groups-nightly:
workflows:
- run-tests-unit: {}
- run-tests-ui-1: {}
- run-tests-ui-2: {}
- run-tests-ui-3: {}
- run-tests-ui-4: {}
# Turning off until iOS 16 is legacy
# - run-tests-ui-1-legacy: {}
# - run-tests-ui-2-legacy: {}
# - run-tests-ui-3-legacy: {}
# - run-tests-ui-4-legacy: {}
deploy-test-results:
should_always_run: true
workflows:
- deploy-test-results: {}
deploy-test-results-nightly:
should_always_run: true
workflows:
- deploy-test-results-nightly: {}
release-build:
workflows:
- release-build: {}
deploy-internal-testflight:
workflows:
- internal-testflight-release: {}
workflows:
#Reusable workflow that is ran before each workflow to setup the necessary information
_setup:
steps:
- brew-install@1:
inputs:
- packages: swiftlint
- activate-ssh-key@4: {}
- git-clone@8: {}
- certificate-and-profile-installer@1: {}
- file-downloader@1:
inputs:
- source: '$BITRISEIO_SECRETS_XCCONFIG_URL'
- destination: '$BITRISE_SOURCE_DIR/Config/secrets.xcconfig'
title: Install production secrets.xcconfig
- resource-archive@2:
inputs:
- extract_to_path: '$BITRISE_SOURCE_DIR/PocketKit/Sources/Textile/Style/Typography/Fonts'
- archive_url: '$BITRISEIO_BASE_FONTS_URL'
title: Install fonts
- resource-archive@2:
inputs:
- extract_to_path: '$BITRISE_SOURCE_DIR/PocketKit/Sources/PocketStickerKit/Stickers'
- archive_url: '$BITRISEIO_STICKERS_URL'
title: Install stickers
- script@1:
title: Download latest schema
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
cd PocketKit
swift package --allow-writing-to-package-directory apollo-cli-install --allow-network-connections all
./apollo-ios-cli fetch-schema
./apollo-ios-cli generate
#Workflow to that can be ran after archiving builds to upload dysms to sentry.
_upload_sentry:
steps:
- script@1:
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
brew tap getsentry/tools
brew install getsentry/tools/sentry-cli
sentry-cli --log-level=debug --auth-token $SENTRY_AUTH_TOKEN upload-dif -o pocket -p ios-next $BITRISE_DSYM_PATH
#TODO: In the future we can add Sentry releases here.
_danger:
steps:
- activate-ssh-key@4: {}
- git-clone@8: {}
- script@1:
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
echo "Run danger"
swift run danger-swift ci
# Helper step to pull the built test bundle.
_pull_test_bundle:
steps:
- pull-intermediate-files@1:
inputs:
- artifact_sources: test-build.test-build
# Helper step to install the last simulator version
_install_past_ios:
steps:
- script@1:
timeout: 600 # 10 minutes
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
brew tap robotsandpencils/made
brew install robotsandpencils/made/xcodes
echo "Install iOS 16 sim"
sudo xcodes runtimes install "iOS 16.4"
# Helper step to start snowplow
_start_snowplow:
steps:
- script@1:
timeout: 300 # 5 minutes
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
## Usually Pocket runs snowplow via our docker image, but Bitrise does not support docker in Mac environments so we use their built jar.
## It uses the values in MICRO_IGLU_REGISTRY_URL and MICRO_IGLU_API_KEY
echo "Run snowplow"
brew install wget openjdk
wget https://github.com/snowplow-incubator/snowplow-micro/releases/download/micro-2.0.0/snowplow-micro-2.0.0.jar
java -jar snowplow-micro-2.0.0.jar &
#Builds a release build that could be uploaded to App Store Connect
release-build:
steps:
- restore-spm-cache@2: {}
- xcode-archive@5:
title: Build an app store release build
inputs:
- project_path: '$BITRISE_PROJECT_PATH'
- scheme: '$BITRISE_SCHEME'
- distribution_method: app-store
- configuration: Release
- xcconfig_content: CURRENT_PROJECT_VERSION = $BITRISE_BUILD_NUMBER
- export_method: app-store
- save-spm-cache@1: {}
- deploy-to-bitrise-io@2:
inputs:
- pipeline_intermediate_files: '$BITRISE_IPA_PATH:BITRISE_IPA_PATH'
before_run:
- _setup
after_run:
- _upload_sentry
# Uses artifacts from the release build stage and workflow to ship the build to testflight.
internal-testflight-release:
steps:
- activate-ssh-key@4: {}
#clone the repo so we can get our fastlane files.
- git-clone@8: {}
- pull-intermediate-files@1:
inputs:
- artifact_sources: release-build.release-build
- fastlane@3:
inputs:
- verbose_log: 'yes'
- lane: beta_internal
test-build:
steps:
- file-downloader@1:
inputs:
- source: '$BITRISEIO_SECRETS_TEST_URL'
- destination: '$BITRISE_SOURCE_DIR/Config/secrets.xcconfig'
title: Install test secrets.xcconfig
- restore-spm-cache@1: {}
- xcode-build-for-test:
inputs:
- destination: generic/platform=iOS Simulator
- save-spm-cache@1: {}
- deploy-to-bitrise-io@2:
inputs:
- pipeline_intermediate_files: '$BITRISE_TEST_BUNDLE_PATH:BITRISE_TEST_BUNDLE_PATH'
before_run:
- _setup
run-tests-unit:
before_run:
- _pull_test_bundle
steps:
- xcode-test-without-building:
timeout: 600 #10 minutes
title: Unit Tests
inputs:
- xctestrun: '${BITRISE_TEST_BUNDLE_PATH}/Pocket (iOS)_UnitTests_iphonesimulator18.1.xctestrun'
- destination: platform=iOS Simulator,name=iPhone 16,OS=18.1
- deploy-to-bitrise-io@2:
inputs:
- pipeline_intermediate_files: '$BITRISE_XCRESULT_PATH:BITRISE_UNIT_XCRESULT_PATH'
debug-build:
steps:
- file-downloader@1:
inputs:
- source: $BITRISEIO_SECRETS_DEVELOPMENT_XCCONFIG_URL
- destination: $BITRISE_SOURCE_DIR/Config/secrets.xcconfig
title: Install development secrets.xcconfig
- fastlane@3:
inputs:
- lane: debug_build
- deploy-to-bitrise-io@2: {}
before_run:
- _setup
run-tests-ui-1:
before_run:
- _pull_test_bundle
- _start_snowplow
steps:
- xcode-test-without-building:
timeout: 1200 #20 minutes
title: UI Test Suite 1
inputs:
- xctestrun: '${BITRISE_TEST_BUNDLE_PATH}/Pocket (iOS)_UITests-1_iphonesimulator18.1-arm64-x86_64.xctestrun'
- destination: platform=iOS Simulator,name=iPhone 16,OS=18.1
- deploy-to-bitrise-io@2:
inputs:
- pipeline_intermediate_files: '$BITRISE_XCRESULT_PATH:BITRISE_UITESTS_1_XCRESULT_PATH'
run-tests-ui-2:
before_run:
- _pull_test_bundle
- _start_snowplow
steps:
- xcode-test-without-building:
timeout: 1200 #20 minutes
title: UI Test Suite 2
inputs:
- xctestrun: '${BITRISE_TEST_BUNDLE_PATH}/Pocket (iOS)_UITests-2_iphonesimulator18.1-arm64-x86_64.xctestrun'
- destination: platform=iOS Simulator,name=iPhone 16,OS=18.1
- deploy-to-bitrise-io@2:
inputs:
- pipeline_intermediate_files: '$BITRISE_XCRESULT_PATH:BITRISE_UITESTS_2_XCRESULT_PATH'
run-tests-ui-3:
before_run:
- _pull_test_bundle
- _start_snowplow
steps:
- xcode-test-without-building:
timeout: 1200 #20 minutes
title: UI Test Suite 3
inputs:
- xctestrun: '${BITRISE_TEST_BUNDLE_PATH}/Pocket (iOS)_UITests-3_iphonesimulator18.1-arm64-x86_64.xctestrun'
- destination: platform=iOS Simulator,name=iPhone 16,OS=18.1
- deploy-to-bitrise-io@2:
inputs:
- pipeline_intermediate_files: '$BITRISE_XCRESULT_PATH:BITRISE_UITESTS_3_XCRESULT_PATH'
run-tests-ui-4:
before_run:
- _pull_test_bundle
- _start_snowplow
steps:
- xcode-test-without-building:
timeout: 1200 #20 minutes
title: UI Test Suite 4
inputs:
- xctestrun: '${BITRISE_TEST_BUNDLE_PATH}/Pocket (iOS)_UITests-4_iphonesimulator18.1-arm64-x86_64.xctestrun'
- destination: platform=iOS Simulator,name=iPhone 16,OS=18.1
- deploy-to-bitrise-io@2:
inputs:
- pipeline_intermediate_files: '$BITRISE_XCRESULT_PATH:BITRISE_UITESTS_4_XCRESULT_PATH'
run-tests-ui-1-legacy:
before_run:
- _install_past_ios
- _pull_test_bundle
- _start_snowplow
steps:
- xcode-test-without-building:
timeout: 1200 #20 minutes
title: UI Test Suite 1 Legacy
inputs:
- xctestrun: '${BITRISE_TEST_BUNDLE_PATH}/Pocket (iOS)_UITests-1_iphonesimulator17.4-arm64-x86_64.xctestrun'
- destination: platform=iOS Simulator,name=iPhone 14,OS=16.4
inputs:
- pipeline_intermediate_files: '$BITRISE_XCRESULT_PATH:BITRISE_UITESTS_1_LEGACY_XCRESULT_PATH'
run-tests-ui-2-legacy:
before_run:
- _install_past_ios
- _pull_test_bundle
- _start_snowplow
steps:
- xcode-test-without-building:
timeout: 1200 #20 minutes
title: UI Test Suite 2 Legacy
inputs:
- xctestrun: '${BITRISE_TEST_BUNDLE_PATH}/Pocket (iOS)_UITests-2_iphonesimulator17.4-arm64-x86_64.xctestrun'
- destination: platform=iOS Simulator,name=iPhone 14,OS=16.4
inputs:
- pipeline_intermediate_files: '$BITRISE_XCRESULT_PATH:BITRISE_UITESTS_2_LEGACY_XCRESULT_PATH'
run-tests-ui-3-legacy:
before_run:
- _install_past_ios
- _pull_test_bundle
- _start_snowplow
steps:
- xcode-test-without-building:
timeout: 1200 #20 minutes
title: UI Test Suite 3 Legacy
inputs:
- xctestrun: '${BITRISE_TEST_BUNDLE_PATH}/Pocket (iOS)_UITests-3_iphonesimulator17.4-arm64-x86_64.xctestrun'
- destination: platform=iOS Simulator,name=iPhone 14,OS=16.4
inputs:
- pipeline_intermediate_files: '$BITRISE_XCRESULT_PATH:BITRISE_UITESTS_3_LEGACY_XCRESULT_PATH'
run-tests-ui-4-legacy:
before_run:
- _install_past_ios
- _pull_test_bundle
- _start_snowplow
steps:
- xcode-test-without-building:
timeout: 1200 #20 minutes
title: UI Test Suite 4 Legacy
inputs:
- xctestrun: '${BITRISE_TEST_BUNDLE_PATH}/Pocket (iOS)_UITests-4_iphonesimulator17.4-arm64-x86_64.xctestrun'
- destination: platform=iOS Simulator,name=iPhone 14,OS=16.4
inputs:
- pipeline_intermediate_files: '$BITRISE_XCRESULT_PATH:BITRISE_UITESTS_4_LEGACY_XCRESULT_PATH'
deploy-test-results:
steps:
- pull-intermediate-files@1:
inputs:
- artifact_sources: run-test-groups\..*
- script@1:
inputs:
- content: |
#!/usr/bin/env bash
set -eo pipefail
xcrun xcresulttool merge "${BITRISE_UITESTS_1_XCRESULT_PATH}" "${BITRISE_UITESTS_2_XCRESULT_PATH}" "${BITRISE_UITESTS_3_XCRESULT_PATH}" "${BITRISE_UITESTS_4_XCRESULT_PATH}" "${BITRISE_UNIT_XCRESULT_PATH}" --output-path "$(pwd)/../merged.xcresult"
envman add --key BITRISE_XCRESULT_PATH --value "$(pwd)/../merged.xcresult"
- custom-test-results-export@1:
inputs:
- search_pattern: '*'
- base_path: $BITRISE_XCRESULT_PATH
- test_name: Pocket Tests
- deploy-to-bitrise-io@2:
inputs:
- pipeline_intermediate_files: '$BITRISE_XCRESULT_PATH:BITRISE_XCRESULT_PATH'
after_run:
- _danger
deploy-test-results-nightly:
steps:
- pull-intermediate-files@1:
inputs:
- artifact_sources: run-test-groups-nightly\..*
- script@1:
inputs:
- content: |
#!/usr/bin/env bash
set -eo pipefail
# Switch to this when legacy is turned back on
# xcrun xcresulttool merge "${BITRISE_UITESTS_1_XCRESULT_PATH}" "${BITRISE_UITESTS_2_XCRESULT_PATH}" "${BITRISE_UITESTS_3_XCRESULT_PATH}" "${BITRISE_UITESTS_4_XCRESULT_PATH}" "${BITRISE_UITESTS_1_LEGACY_XCRESULT_PATH}" "${BITRISE_UITESTS_2_LEGACY_XCRESULT_PATH}" "${BITRISE_UITESTS_3_LEGACY_XCRESULT_PATH}" "${BITRISE_UITESTS_4_LEGACY_XCRESULT_PATH}" "${BITRISE_UNIT_XCRESULT_PATH}" --output-path "$(pwd)/../merged.xcresult"
xcrun xcresulttool merge "${BITRISE_UITESTS_1_XCRESULT_PATH}" "${BITRISE_UITESTS_2_XCRESULT_PATH}" "${BITRISE_UITESTS_3_XCRESULT_PATH}" "${BITRISE_UITESTS_4_XCRESULT_PATH}" "${BITRISE_UNIT_XCRESULT_PATH}" --output-path "$(pwd)/../merged.xcresult"
envman add --key BITRISE_XCRESULT_PATH --value "$(pwd)/../merged.xcresult"
- custom-test-results-export@1:
inputs:
- search_pattern: '*'
- base_path: $BITRISE_XCRESULT_PATH
- test_name: Pocket Tests
- deploy-to-bitrise-io@2:
inputs:
- pipeline_intermediate_files: '$BITRISE_XCRESULT_PATH:BITRISE_XCRESULT_PATH'
app:
envs:
- opts:
is_expand: false
BITRISE_PROJECT_PATH: Pocket.xcodeproj
- opts:
is_expand: false
BITRISE_SCHEME: Pocket (iOS)
- opts:
is_expand: false
BITRISE_EXPORT_METHOD: development
- opts:
is_expand: false
SKIP_APOLLO_CODEGEN: '1'
meta:
bitrise.io:
machine_type_id: g2-m1-max.10core
stack: osx-xcode-16.1.x-edge