-
Notifications
You must be signed in to change notification settings - Fork 11
/
bitrise.yml
278 lines (274 loc) · 8.81 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
format_version: 11
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: android
trigger_map:
- push_branch: "master"
workflow: build-and-test
- push_branch: release/*
workflow: build-and-test
- pull_request_source_branch: "*"
pull_request_target_branch: "master"
workflow: build-and-test
- pull_request_source_branch: "*"
pull_request_target_branch: release/*
workflow: build-and-test
- tag: "v*.*.*+*"
workflow: build-and-test
- tag: "v*.*.*"
workflow: release
workflows:
build-and-test:
before_run:
- _setup-env
- _common-start
after_run:
- _common-end
- _publish-apk
steps:
- cache-pull@2: {}
- script@1:
title: Run some verification tasks
inputs:
- content: "./gradlew detekt detektRelease lintAnalyzeDebug lintDebug lintReportDebug testDebugUnitTest jacocoDebugReport"
- custom-test-results-export@0:
inputs:
- test_name: "${SDK_PATH}_debug"
- base_path: "$SDK_PATH/build/test-results/testDebugUnitTest/"
- search_pattern: "*"
integration-test:
before_run:
- _setup-env
- _common-start
steps:
- script@1:
title: Run Tests
inputs:
- content: ./gradlew clean testRelease --tests com.rakuten.tech.mobile.inappmessaging.runtime.integration.IntegrationSpec
- custom-test-results-export@0:
inputs:
- test_name: Integration Tests
- base_path: "$SDK_PATH/build/test-results/testReleaseUnitTest/"
- search_pattern: "*"
- deploy-to-bitrise-io@2:
inputs:
- deploy_path: "$SDK_PATH/build/test-results/testReleaseUnitTest/"
- is_enable_public_page: 'false'
- slack@3:
inputs:
- channel: ''
- webhook_url: "$SLACK_CHANNEL_WEBHOOK"
- text: ''
- title: ''
- author_name: ''
- channel_on_error: ''
- pretext: ''
- pretext_on_error: ''
- message_on_error: |+
$BITRISE_APP_TITLE » $BITRISE_TRIGGERED_WORKFLOW_TITLE - #$BITRISE_BUILD_NUMBER *Failure*
<$BITRISE_BUILD_URL|Open>
- message: |+
$BITRISE_APP_TITLE » $BITRISE_TRIGGERED_WORKFLOW_TITLE - #$BITRISE_BUILD_NUMBER *Success*
<$BITRISE_BUILD_URL|Open>
- fields: ''
- buttons: ''
- footer: ''
- footer_icon: ''
- timestamp: 'no'
- icon_url_on_error: ''
- from_username_on_error: ''
- color_on_error: "#d10b20"
release:
before_run:
- _setup-env
- _common-start
after_run:
- _common-end
- _post_discourse
- _publish-doc
- _create-github-release
steps:
- script@1:
title: Run Check
inputs:
- content: "./gradlew check"
- script@1:
title: Assemble
inputs:
- content: "./gradlew assemble"
- script@1:
title: Current Version
inputs:
- content: "./gradlew currentVersion"
- custom-test-results-export@0:
inputs:
- test_name: "${SDK_PATH}_release"
- base_path: "$SDK_PATH/build/test-results/testReleaseUnitTest/"
- search_pattern: "*"
- script@1:
title: Retrieve Base64 PGP Key and save to file
inputs:
- content: |-
if [[ "$RELEASE_PGP_KEY_BASE64" != "" ]]; then
base64 -d <<< "$RELEASE_PGP_KEY_BASE64" > ./maven-central-key.gpg
fi
- script@1:
title: Publish Artifacts
inputs:
- content: ./gradlew publish
_setup-env:
steps:
- set-java-version@1:
inputs:
- set_java_version: '17'
- git-clone@6:
inputs:
- fetch_tags: 'yes'
- merge_pr: 'no'
- update_submodules: 'yes'
_publish-doc:
steps:
- script@1:
title: Publish Documentation
inputs:
- content: |-
#!/bin/bash
set -e
./gradlew generatePublishableDocs
if [[ ! $BITRISE_GIT_TAG == *"-"* ]]; then
git fetch --no-tags origin gh-pages
git checkout gh-pages
cp -R inappmessaging/build/publishableDocs/docs/. ./docs
cp -R inappmessaging/build/publishableDocs/_versions/. ./_versions
git add docs _versions
git config user.name "CI Publisher"
git config user.email "[email protected]"
git commit -m "Publish documentation for $BITRISE_GIT_TAG"
git config url."https://x-token-auth:[email protected]".insteadOf https://github.com
git push origin gh-pages
else
echo "Documentation not published for snapshot version"
fi
_run-sonarqube-scanner:
steps:
- script@1:
title: Prepare branches to feed in sonar.gradle
description: This step ensures that source and destination branches exist. For sonarqube to work, the current working branch should be the source branch.
inputs:
- content: |-
#!/bin/bash
set -e
if [[ $BITRISE_GIT_TAG != "" ]]; then
echo "Branch analysis but using tag name. BITRISE_GIT_TAG=$BITRISE_GIT_TAG"
git fetch --no-tags origin $BITRISE_GIT_TAG
git checkout $BITRISE_GIT_TAG
elif [[ $BITRISEIO_PULL_REQUEST_REPOSITORY_URL == "" ]]; then
echo "Normal branch analysis. BITRISE_GIT_BRANCH=$BITRISE_GIT_BRANCH"
git fetch --no-tags origin $BITRISE_GIT_BRANCH
git switch $BITRISE_GIT_BRANCH
else
# PR analysis
git fetch --no-tags origin $BITRISEIO_GIT_BRANCH_DEST
echo "PR analysis. BITRISEIO_GIT_BRANCH_DEST=$BITRISEIO_GIT_BRANCH_DEST. BITRISE_GIT_BRANCH=$BITRISE_GIT_BRANCH"
if [[ $BITRISEIO_PULL_REQUEST_REPOSITORY_URL != "" && \
$GIT_REPOSITORY_URL != $BITRISEIO_PULL_REQUEST_REPOSITORY_URL ]]; then
# Fork
git switch -C $BITRISE_GIT_BRANCH
else
# Non-fork
git fetch --no-tags origin $BITRISE_GIT_BRANCH
git switch $BITRISE_GIT_BRANCH
fi
fi
- script@1:
run_if: '{{getenv "SONARQUBE_TOKEN" | ne ""}}'
title: Run SonarQube Scanner
inputs:
- content: ./gradlew sonarqube
_post_discourse:
steps:
- script@1:
run_if: false
title: Post To Discourse
inputs:
- content: |-
#!/usr/bin/env
./post-to-discourse.sh $BITRISE_GIT_TAG
_common-start:
steps:
- cache-pull@2: {}
- script@1:
title: Run Dependency Check
inputs:
- timeout: 1800
- content: "./gradlew dependencyCheckAggregate"
- deploy-to-bitrise-io:
title: Deploy Dependency Check Report
inputs:
- deploy_path: "$SDK_PATH/build/reports/dependency-check-report.html"
_common-end:
after_run:
- _run-sonarqube-scanner
steps:
- script@1:
title: Danger
run_if: '{{enveq "RUN_DANGER" "true"}}'
inputs:
- content: |-
bundle install
bundle exec danger --dangerfile=config/danger/Dangerfile
- deploy-to-bitrise-io@2: {}
- cache-push@2:
inputs:
- cache_paths: |-
$HOME/.gradle
./.gradle
$HOME/.m2
- ignore_check_on_paths: |-
$HOME/.gradle/caches/*.lock
./.gradle/*.lock
./.gradle/*.bin
_create-github-release:
steps:
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
# Ensure we are at the right location where the userguide is (not in other branch such as `gh-pages`)
git checkout $BITRISE_GIT_TAG
RELEASE_VER_RAW=$BITRISE_GIT_TAG
RELEASE_VER_RAW="${RELEASE_VER_RAW/v}"
awk "
/## $RELEASE_VER_RAW/{flag=1;next}
/## [0-9]/{flag=0}
flag
" $USERGUIDE_PATH > _releasenotes.md
RELEASE_NOTES=$(cat _releasenotes.md)
envman add --key RELEASE_NOTES --value "$RELEASE_NOTES"
inputs:
- body: "$RELEASE_NOTES"
- draft: 'no'
- username: "$GITHUB_BOT_USERNAME"
- api_token: "$GITHUB_BOT_API_TOKEN"
- name: "$BITRISE_GIT_TAG"
_publish-apk:
steps:
- script@1:
title: Generate test-debug.apk
inputs:
- content: "./gradlew :test:assembleDebug"
- deploy-to-bitrise-io@2:
is_always_run: false
inputs:
- is_enable_public_page: 'false'
- deploy_path: test/build/outputs/apk/debug/test-debug.apk
meta:
bitrise.io:
stack: linux-docker-android-20.04
machine_type_id: elite
app:
envs:
- opts:
is_expand: false
SDK_PATH: inappmessaging