-
Notifications
You must be signed in to change notification settings - Fork 19
480 lines (416 loc) · 15.5 KB
/
on_push_workflow.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
name: Last push build
on:
workflow_dispatch:
push:
branches: [ dev ]
env:
RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD }}
RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
RELEASE_STORE_FILE: ${{ secrets.RELEASE_STORE_FILE }}
DEVELOPMENT_MODE: ${{ secrets.DEVELOPMENT_MODE }}
USE_LOCAL_DEPENDENCY: ${{ vars.USE_LOCAL_DEPENDENCY }}
RELEASE_MODE: ${{ vars.RELEASE_MODE }}
ANDROID_RELEASE_STORE_FILE_BASE64: ${{ secrets.ANDROID_RELEASE_STORE_FILE_BASE64 }}
ANDROID_RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_RELEASE_STORE_PASSWORD }}
ANDROID_RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEY_ALIAS }}
ANDROID_RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }}
FIREBASE_PROJECT_ID: ${{ vars.FIREBASE_PROJECT_ID }}
FIREBASE_SERVICE_ACCOUNT_JSON: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}
GOOGLE_OAUTH_SERVER_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_SERVER_CLIENT_ID }}
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
SONATYPE_SIGNING_KEY_ID: ${{ secrets.SONATYPE_SIGNING_KEY_ID }}
SONATYPE_SIGNING_PASSWORD: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
SONATYPE_SIGNING_SECRET_KEY_RING_FILE_BASE64: ${{ secrets.SONATYPE_SIGNING_SECRET_KEY_RING_FILE_BASE64 }}
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_ICON: https://icons.iconarchive.com/icons/martz90/circle/256/android-icon.png
SLACK_TITLE: Commit status
SLACK_USERNAME: Emarsys SDK - Android
SLACK_WEBHOOK: ${{ secrets.SLACK_MOBILE_TEAM_CI_CHANNEL_WEBHOOK }}
jobs:
Build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
name: Build job
steps:
- uses: actions/checkout@v3
with:
ref: dev
submodules: true
fetch-depth: 0 # 0 indicates all history
- run: git fetch --all || echo "==> Accept any result"
- name: set up JDK 1.17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Prepare CI
run: make prepare-ci
- name: Build with Gradle
run: make build-test
- name: upload sample app artifact
uses: actions/upload-artifact@v2
with:
name: sample
path: sample/build/outputs/apk/androidTest/debug/sample-debug-androidTest.apk
- name: upload core test apk artifact
uses: actions/upload-artifact@v2
with:
name: core
path: core/build/outputs/apk/androidTest/debug/core-debug-androidTest.apk
- name: upload mobile-engage test apk artifact
uses: actions/upload-artifact@v2
with:
name: mobile-engage
path: mobile-engage/build/outputs/apk/androidTest/debug/mobile-engage-debug-androidTest.apk
- name: upload emarsys-sdk test apk artifact
uses: actions/upload-artifact@v2
with:
name: predict
path: predict/build/outputs/apk/androidTest/debug/predict-debug-androidTest.apk
- name: upload emarsys test apk artifact
uses: actions/upload-artifact@v2
with:
name: emarsys
path: emarsys/build/outputs/apk/androidTest/debug/emarsys-debug-androidTest.apk
- name: upload emarsys-sdk test apk artifact
uses: actions/upload-artifact@v2
with:
name: emarsys-sdk
path: emarsys-sdk/build/outputs/apk/androidTest/debug/emarsys-sdk-debug-androidTest.apk
- name: upload common test apk artifact
uses: actions/upload-artifact@v2
with:
name: common
path: common/build/outputs/apk/androidTest/debug/common-debug-androidTest.apk
- name: upload emarsys-firebase test apk artifact
uses: actions/upload-artifact@v2
with:
name: emarsys-firebase
path: emarsys-firebase/build/outputs/apk/androidTest/debug/emarsys-firebase-debug-androidTest.apk
- name: upload emarsys-huawei test apk artifact
uses: actions/upload-artifact@v2
with:
name: emarsys-huawei
path: emarsys-huawei/build/outputs/apk/androidTest/debug/emarsys-huawei-debug-androidTest.apk
- name: create testlab services json
uses: jsdaniell/[email protected]
with:
name: sacc_key.json
json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
GradleLint:
name: Run lint on project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # 0 indicates all history
- run: git fetch --all || echo "==> Accept any result"
- name: set up JDK 1.17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: create-google services json
uses: jsdaniell/[email protected]
with:
name: google-services.json
json: ${{ secrets.GOOGLE_SERVICES_JSON }}
dir: sample
- name: create local.properties
run: echo $ANDROID_HOME > local.properties
- name: Lint project with Gradle
run: ./gradlew lint
CreateReleaseBundle:
name: Create release bundle
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # 0 indicates all history
- run: git fetch --all || echo "==> Accept any result"
- name: set up JDK 1.17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: create-google services json
uses: jsdaniell/[email protected]
with:
name: google-services.json
json: ${{ secrets.GOOGLE_SERVICES_JSON }}
dir: sample
- name: create local.properties
run: echo $ANDROID_HOME > local.properties
- name: Create release keystore file
shell: bash
run: |
echo "${{ secrets.ANDROID_KEYSTORE }}" > mobile-team-android.jks.asc
gpg -d --passphrase "${{ secrets.ANDROID_GPG_PASSWORD }}" --batch mobile-team-android.jks.asc > sample/mobile-team-android.jks
- name: Create release sample app with Gradle
run: ./gradlew :sample:bundleRelease
- name: Upload bundle
uses: actions/upload-artifact@v2
with:
name: mobile-sdk-sample
path: sample/build/outputs/bundle/release/sample-release.aab
TestCore:
name: Run core tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # 0 indicates all history
- run: git fetch --all || echo "==> Accept any result"
- name: Download sample app
uses: actions/download-artifact@v2
with:
name: sample
- name: Download core tests
uses: actions/download-artifact@v2
with:
name: core
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:core'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
TestMobileEngage:
name: Run mobile-engage tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # 0 indicates all history
- run: git fetch --all || echo "==> Accept any result"
- name: Download sample app
uses: actions/download-artifact@v2
with:
name: sample
- name: Download mobile-engage tests
uses: actions/download-artifact@v2
with:
name: mobile-engage
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:mobile-engage'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
TestPredict:
name: Run predict tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # 0 indicates all history
- run: git fetch --all || echo "==> Accept any result"
- name: Download sample app
uses: actions/download-artifact@v2
with:
name: sample
- name: Download predict tests
uses: actions/download-artifact@v2
with:
name: predict
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:predict'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
TestEmarsysSDK:
name: Run emarsys-sdk tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # 0 indicates all history
- run: git fetch --all || echo "==> Accept any result"
- name: Download sample app
uses: actions/download-artifact@v2
with:
name: sample
- name: Download emarsys-sdk tests
uses: actions/download-artifact@v2
with:
name: emarsys-sdk
- name: Display structure of downloaded files
run: ls -R
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:emarsys-sdk'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
TestEmarsys:
name: Run emarsys tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # 0 indicates all history
- run: git fetch --all || echo "==> Accept any result"
- name: Download sample app
uses: actions/download-artifact@v2
with:
name: sample
- name: Download emarsys tests
uses: actions/download-artifact@v2
with:
name: emarsys
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:emarsys'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
TestCommon:
name: Run common tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # 0 indicates all history
- run: git fetch --all || echo "==> Accept any result"
- name: Download sample app
uses: actions/download-artifact@v2
with:
name: sample
- name: Download common tests
uses: actions/download-artifact@v2
with:
name: common
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:common'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
TestEmarsysFirebase:
name: Run emarsys-firebase tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # 0 indicates all history
- run: git fetch --all || echo "==> Accept any result"
- name: Download sample app
uses: actions/download-artifact@v2
with:
name: sample
- name: Download emarsys-firebase tests
uses: actions/download-artifact@v2
with:
name: emarsys-firebase
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:emarsys-firebase'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
TestEmarsysHuawei:
name: Run emarsys-huawei tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # 0 indicates all history
- run: git fetch --all || echo "==> Accept any result"
- name: Download sample app
uses: actions/download-artifact@v2
with:
name: sample
- name: Download emarsys-huawei tests
uses: actions/download-artifact@v2
with:
name: emarsys-huawei
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:emarsys-huawei'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
ReleaseSample:
name: Release sample app
runs-on: ubuntu-latest
needs: [ Build, TestCore, TestMobileEngage, TestPredict, TestEmarsysSDK, TestEmarsys, TestCommon, TestEmarsysFirebase, TestEmarsysHuawei, CreateReleaseBundle, GradleLint ]
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # 0 indicates all history
- run: git fetch --all || echo "==> Accept any result"
- name: Download sample app
uses: actions/download-artifact@v2
with:
name: mobile-sdk-sample
- name: create-google services json
uses: jsdaniell/[email protected]
with:
name: google-play-services.json
json: ${{ secrets.GOOGLE_PLAY_STORE_SEVICE_ACCOUNT_JSON }}
- name: Playstore upload
uses: r0adkll/[email protected]
with:
serviceAccountJson: google-play-services.json
packageName: com.emarsys.sample
releaseFile: sample-release.aab
track: alpha
SlackNotification:
name: Send slack notification
runs-on: ubuntu-latest
needs: [ ReleaseSample ]
steps:
- name: Slack Notification
uses: megamegax/[email protected]
with:
channel: '${{env.SLACK_CHANNEL}}'
message: 'Last push build successful! :man-gesturing-ok: :bananadance:'
user_name: '${{env.SLACK_USERNAME}}'
job_status: 'success'
user_icon: '${{env.SLACK_ICON}}'
actions: '[{ "type": "button", "text": "View actions", "url": "https://github.com/emartech/android-emarsys-sdk/actions" },{ "type": "button", "text": "View Firebase", "url": "https://console.firebase.google.com/project/ems-mobile-sdk/testlab/histories/" },{ "type": "button", "text": "Install page", "url": "http://ems-mobileteam-artifacts.s3-website-eu-west-1.amazonaws.com/index-ems.html" }]'
SlackNotificationOnError:
name: Send slack on error
runs-on: ubuntu-latest
needs: [ ReleaseSample ]
if: ${{ failure() }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # 0 indicates all history
- run: git fetch --all || echo "==> Accept any result"
- name: Slack Notification
uses: megamegax/[email protected]
with:
channel: '${{env.SLACK_CHANNEL}}'
message: 'Last push build failed! :man-gesturing-no: :blobcatfearful:'
user_name: '${{env.SLACK_USERNAME}}'
job_status: 'failure'
user_icon: '${{env.SLACK_ICON}}'
actions: '[{ "type": "button", "text": "View actions", "url": "https://github.com/emartech/android-emarsys-sdk/actions" },{ "type": "button", "text": "View Firebase", "url": "https://console.firebase.google.com/project/ems-mobile-sdk/testlab/histories/" }]'