-
Notifications
You must be signed in to change notification settings - Fork 1
/
bitrise.yml
441 lines (428 loc) · 15.6 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
format_version: "8"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: android
workflows:
_increment_project_version:
steps:
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully
set -o pipefail
# debug log
set -x
if [ ! -z "$GITHUB_VERSION_INCREMENT_TYPE" ] ; then
envman add --key VERSION_INCREMENT_TYPE --value "$GITHUB_VERSION_INCREMENT_TYPE"
fi
- gradle-runner@2:
title: Increment project version
inputs:
- gradle_file: $PROJECT_LOCATION/build.gradle
- gradlew_path: $PROJECT_LOCATION/gradlew
- gradle_task: saveWidgetsVersion --type=$VERSION_INCREMENT_TYPE
- script@1:
title: Create PR
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully
set -o pipefail
# debug log
set -x
NEW_VERSION=`./gradlew -q printCurrentVersionName`
NEW_BRANCH_NAME="project-version-increment/${NEW_VERSION}"
BASE_BRANCH_NAME="development"
MESSAGE="Increment project version to ${NEW_VERSION}"
git fetch origin $BASE_BRANCH_NAME
git checkout -b $NEW_BRANCH_NAME origin/$BASE_BRANCH_NAME
# git add -u stages modifications and deletions, without new files
# added it to prevent CHANGELOG.md from being included in the PR
git add -u
git commit -m "$MESSAGE"
git push origin "$NEW_BRANCH_NAME":"$NEW_BRANCH_NAME"
PULL_REQUEST_NUMBER=$(curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_API_TOKEN" \
https://api.github.com/repos/salemove/android-sdk-widgets/pulls \
-d "{\"title\":\"${MESSAGE}\",\"head\":\"${NEW_BRANCH_NAME}\",\"base\":\"development\"}" | jq --raw-output '.number')
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_API_TOKEN" \
https://api.github.com/repos/salemove/android-sdk-widgets/pulls/$PULL_REQUEST_NUMBER/requested_reviewers \
-d "{\"team_reviewers\":[\"tm-mobile-android\"]}"
envs:
- opts:
is_expand: false
VERSION_INCREMENT_TYPE: patch
authenticated_increment_project_version:
description: Task builds an SDK and uploads it to Nexus.
steps:
- activate-ssh-key@4: { }
- git-clone@8: { }
- cache-pull@2: { }
- set-java-version@1:
is_always_run: true
inputs:
- set_java_version: "17"
- install-missing-android-tools@3:
inputs:
- gradlew_path: $PROJECT_LOCATION/gradlew
- cache-push@2: { }
after_run:
- _increment_project_version
browserstack_upload:
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@8: { }
- cache-pull@2: { }
- set-java-version@1:
is_always_run: true
inputs:
- set_java_version: "17"
- install-missing-android-tools@3:
inputs:
- gradlew_path: $PROJECT_LOCATION/gradlew
inputs:
- variant: $INTEGRATOR_VARIANT
- module: $EXAMPLE_APP_MODULE
- browserstack-upload@0:
title: Upload APP to BrowserStack
inputs:
- custom_id: $BROWSERSTACK_APP_ID
- deploy-to-bitrise-io@2:
inputs:
- notify_email_list: $BUILD_EMAILS
- cache-push@2: { }
development:
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@8: { }
- cache-pull@2: { }
- set-java-version@1:
is_always_run: true
inputs:
- set_java_version: "17"
- install-missing-android-tools@3:
inputs:
- gradlew_path: $PROJECT_LOCATION/gradlew
- android-build@1:
inputs:
- variant: $INTEGRATOR_VARIANT
- module: $EXAMPLE_APP_MODULE
- android-lint@0:
title: Run Lint for SDK
inputs:
- project_location: $PROJECT_LOCATION
- module: $WIDGET_SDK_MODULE
- variant: $SDK_VARIANT
- android-unit-test@1:
title: Unit Test for SDK
inputs:
- project_location: $PROJECT_LOCATION
- module: $WIDGET_SDK_MODULE
- variant: $SDK_VARIANT
- android-lint@0:
title: Run Lint for APP
inputs:
- project_location: $PROJECT_LOCATION
- module: $EXAMPLE_APP_MODULE
- variant: $DEBUG_VARIANT
- android-unit-test@1:
title: Unit Test for APP
inputs:
- project_location: $PROJECT_LOCATION
- module: $EXAMPLE_APP_MODULE
- variant: $DEBUG_VARIANT
- browserstack-upload@0:
title: Upload APP to BrowserStack
inputs:
- custom_id: $BROWSERSTACK_APP_ID
- deploy-to-bitrise-io@2:
inputs:
- notify_email_list: $BUILD_EMAILS
- slack@4:
is_always_run: true
inputs:
- channel: '#tm-mobile-builds'
- text: Android Build Succeeded!
- webhook_url_on_error: $SLACK_ANDROID_WEBHOOK
- channel_on_error: '#tm-mobile'
- text_on_error: '@mobile-caretaker Android Build Failed! (development-build)'
- emoji_on_error: "\U0001F4A5"
- color_on_error: '#d9482b'
- from_username_on_error: Bitrise
- pretext: ""
- webhook_url: $SLACK_ANDROID_WEBHOOK
- cache-push@2: { }
post_release:
steps:
- trigger-bitrise-workflow@0:
inputs:
- api_token: $ANDROID_CORTEX_BANKING_APP_BUILD_TRIGGER_TOKEN
- workflow_id: upgrade_dependencies
- exported_environment_variable_names: NEW_VERSION
- app_slug: $ANDROID_CORTEX_BANKING_APP_SLUG
publish_to_nexus:
description: Task builds an SDK and uploads it to Nexus.
steps:
- activate-ssh-key@4: { }
- git-clone:
inputs:
- clone_depth: "-1"
- fetch_tags: "yes"
- cache-pull@2: { }
- set-java-version@1:
is_always_run: true
inputs:
- set_java_version: "17"
- install-missing-android-tools@3:
inputs:
- gradlew_path: $PROJECT_LOCATION/gradlew
- android-build@1:
inputs:
- variant: $INTEGRATOR_VARIANT
- module: $EXAMPLE_APP_MODULE
- android-unit-test@1:
inputs:
- module: $WIDGET_SDK_MODULE
- variant: $SDK_VARIANT
- project_location: $PROJECT_LOCATION
- android-unit-test@1:
inputs:
- module: $EXAMPLE_APP_MODULE
- variant: $DEBUG_VARIANT
- project_location: $PROJECT_LOCATION
- gradle-runner@2:
title: Generate JavaDoc
inputs:
- gradle_task: $WIDGET_SDK_MODULE:dokkaJavadoc
- amazon-s3-upload@3:
title: Upload JavaDoc
inputs:
- secret_access_key: $AMAZON_AWS_SECRET
- upload_bucket: $AMAZON_AWS_NAME/widgets
- acl_control: public-read
- upload_local_path: $PROJECT_LOCATION/$WIDGET_SDK_MODULE/build/dokka
- access_key_id: $AMAZON_AWS_KEY
- script@1:
title: Publish Android SDK to Nexus Repository Manager (Staging)
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# this will run Gradle script to deploy library and related artifacts to Maven Central
./gradlew clean widgetssdk:publishReleasePublicationToSonatypeRepository
- git-tag@1:
inputs:
- tag: $NEW_VERSION
- script@1:
title: Generate changelog
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# run the local bash script
bash ./scripts/generate-changelog.sh
- github-release@0:
inputs:
- username: $GITHUB_USERNAME
- tag: $NEW_VERSION
- commit: $GIT_CLONE_COMMIT_HASH
- name: Glia Android Widgets $NEW_VERSION
- body: $BITRISE_CHANGELOG
- draft: "no"
- api_token: $GITHUB_API_TOKEN
- cache-push@2: { }
after_run:
- _increment_project_version
pull_request:
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@8: { }
- cache-pull@2: { }
- set-java-version@1:
is_always_run: true
inputs:
- set_java_version: "17"
- install-missing-android-tools@3:
inputs:
- gradlew_path: $PROJECT_LOCATION/gradlew
- android-lint@0:
title: Run Lint for SDK
inputs:
- project_location: $PROJECT_LOCATION
- module: $WIDGET_SDK_MODULE
- variant: $SDK_VARIANT
- android-unit-test@1:
title: Unit Test for SDK
inputs:
- project_location: $PROJECT_LOCATION
- module: $WIDGET_SDK_MODULE
- variant: debug
- gradle-unit-test@1:
title: Snapshot Test for SDK
inputs:
- unit_test_flags: ""
- unit_test_task: $WIDGET_SDK_MODULE:verifyPaparazziSnapshot
is_always_run: true
- script@1:
title: Export reports for Snapshot Test for SDK
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
REPORTS_DIR=$BITRISE_SOURCE_DIR/widgetssdk/build/reports/tests/testSnapshotUnitTest
if [ -d "$REPORTS_DIR" ]; then
cd $REPORTS_DIR
zip -r $BITRISE_DEPLOY_DIR/widgetssdk-snapshotTests.zip *
fi
SNAPSHOT_DIR=$BITRISE_SOURCE_DIR/widgetssdk/build/paparazzi
if [ -d "$SNAPSHOT_DIR" ]; then
cd $SNAPSHOT_DIR
zip -r $BITRISE_DEPLOY_DIR/widgetssdk-snapshots.zip *
fi
is_always_run: true
- android-lint@0:
title: Run Lint for APP
inputs:
- project_location: $PROJECT_LOCATION
- module: $EXAMPLE_APP_MODULE
- variant: $DEBUG_VARIANT
- android-unit-test@1:
title: Unit Test for APP
inputs:
- project_location: $PROJECT_LOCATION
- module: $EXAMPLE_APP_MODULE
- variant: $DEBUG_VARIANT
- gradle-runner@2:
title: Assemble SDK for instrumentation tests
inputs:
- gradlew_path: ./gradlew
- gradle_task: :$WIDGET_SDK_MODULE:assembleDebugAndroidTest
- virtual-device-testing-for-android@1:
title: UI Test for APP
inputs:
- test_type: instrumentation
- use_verbose_log: true
- deploy-to-bitrise-io@2: { }
- cache-push@2: { }
upgrade_dependencies:
steps:
- activate-ssh-key@4: { }
- git-clone@6: { }
- cache-pull@2: { }
is_always_run: true
inputs:
- set_java_version: "17"
- install-missing-android-tools@3:
inputs:
- gradlew_path: $PROJECT_LOCATION/gradlew
- gradle-runner@2:
title: Upgrade Core SDK version
inputs:
- gradlew_path: $PROJECT_LOCATION/gradlew
- gradle_file: $PROJECT_LOCATION/build.gradle
- gradle_task: saveCoreSdkVersion --coreSdkVersion=$NEW_VERSION
- script@1:
title: Create PR
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully
set -o pipefail
# debug log
set -x
NEW_BRANCH_NAME="core-sdk-version-increment/${NEW_VERSION}"
BASE_BRANCH_NAME="development"
MESSAGE="Increment Core SDK version to ${NEW_VERSION}"
git fetch origin $BASE_BRANCH_NAME
git checkout -b $NEW_BRANCH_NAME origin/$BASE_BRANCH_NAME
git add -A
git commit -m "$MESSAGE"
git push origin "$NEW_BRANCH_NAME":"$NEW_BRANCH_NAME"
PULL_REQUEST_NUMBER=$(curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_API_TOKEN" \
https://api.github.com/repos/salemove/android-sdk-widgets/pulls \
-d "{\"title\":\"${MESSAGE}\",\"head\":\"${NEW_BRANCH_NAME}\",\"base\":\"development\"}" | jq --raw-output '.number')
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_API_TOKEN" \
https://api.github.com/repos/salemove/android-sdk-widgets/pulls/$PULL_REQUEST_NUMBER/requested_reviewers \
-d "{\"team_reviewers\":[\"tm-mobile-android\"]}"
- cache-push@2: { }
app:
envs:
- opts:
is_expand: false
PROJECT_LOCATION: .
- opts:
is_expand: false
GRADLE_BUILD_FILE_PATH: build.gradle
- opts:
is_expand: false
GRADLEW_PATH: ./gradlew
- opts:
is_expand: false
EXAMPLE_APP_MODULE: app
- opts:
is_expand: false
WIDGET_SDK_MODULE: widgetssdk
- opts:
is_expand: false
SDK_VARIANT: debug
- opts:
is_expand: false
BROWSERSTACK_APP_ID: WidgetsSdkAndroidTestApp
- opts:
is_expand: false
TEST_APP_MODULE: app
- opts:
is_expand: false
ANDROID_CORTEX_BANKING_APP_SLUG: 0376f45568cb22dd
- opts:
is_expand: false
DEBUG_VARIANT: debug
- opts:
is_expand: false
INTEGRATOR_VARIANT: release
- opts:
is_expand: false
GIT_AUTHOR_NAME: BitriseBot
- opts:
is_expand: false
GIT_AUTHOR_EMAIL: [email protected]
trigger_map:
- push_branch: development
workflow: development
- pull_request_target_branch: '*'
workflow: pull_request
meta:
bitrise.io:
stack: linux-docker-android-22.04
machine_type_id: standard