-
Notifications
You must be signed in to change notification settings - Fork 19
161 lines (142 loc) · 6.37 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
name: On Push
on:
pull_request:
types: [ opened, reopened, synchronize ]
push:
branches-ignore:
- 'dependabot/**'
workflow_dispatch:
inputs:
track:
type: choice
description: 'A track to assign the sample app'
options:
- alpha
- beta
- stable
default: alpha
env:
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 }}
GOOGLE_PLAY_STORE_SEVICE_ACCOUNT_JSON_BASE64: ${{ secrets.GOOGLE_PLAY_STORE_SEVICE_ACCOUNT_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 }}
FIREBASE_WEB_SERVER_CLIENT_ID: ${{ secrets.FIREBASE_WEB_SERVER_CLIENT_ID }}
jobs:
Test:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
name: Test & Lint
strategy:
matrix:
include:
- task: core
- task: mobile-engage
- task: predict
- task: emarsys-firebase
- task: emarsys-huawei
- task: emarsys-sdk
- task: lint
steps:
- uses: actions/checkout@v4
with:
ref: dev
submodules: true
fetch-depth: 0 # 0 indicates all history
- name: Set up JDK 1.17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.6
cache-overwrite-existing: true
gradle-home-cache-cleanup: true
- name: Prepare CI
run: make prepare-ci
- name: Authenticate to Google Cloud
uses: google-github-actions/[email protected]
with:
workload_identity_provider: 'projects/395478287999/locations/global/workloadIdentityPools/github-actions/providers/github-actions'
service_account: 'firebase-test-lab-service-acco@ems-mobile-sdk.iam.gserviceaccount.com'
create_credentials_file: true
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Build
run: make build-test
- name: Test core
if: matrix.task == 'core'
run: make test-android-firebase-emulator MODULE_NAME=core
- name: Test mobile-engage
if: matrix.task == 'mobile-engage'
run: make test-android-firebase-emulator MODULE_NAME=mobile-engage
- name: Test predict
if: matrix.task == 'predict'
run: make test-android-firebase-emulator MODULE_NAME=predict
- name: Test emarsys-firebase
if: matrix.task == 'emarsys-firebase'
run: make test-android-firebase-emulator MODULE_NAME=emarsys-firebase
- name: Test emarsys-huawei
if: matrix.module == 'emarsys-huawei'
run: make task-android-firebase-emulator MODULE_NAME=emarsys-huawei
- name: Test emarsys-sdk
if: matrix.task == 'emarsys-sdk'
run: make test-android-firebase-emulator MODULE_NAME=emarsys-sdk
- name: Run lint
if: matrix.task == 'lint'
run: make lint
Report:
if: always()
needs: [ Test ]
runs-on: ubuntu-latest
steps:
- name: Report on Slack (Error)
if: ${{ !cancelled() && contains(needs.*.result, 'failure') }}
uses: megamegax/[email protected]
with:
webhook_url: '${{env.SLACK_WEBHOOK}}'
channel: '${{env.SLACK_CHANNEL}}'
message: 'On push workflow 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/" }]'
- name: Report on Slack (Success)
if: ${{ !contains(needs.*.result, 'cancelled') && !contains(needs.*.result, 'failure') }}
uses: megamegax/[email protected]
with:
webhook_url: '${{env.SLACK_WEBHOOK}}'
channel: '${{env.SLACK_CHANNEL}}'
message: 'On push workflow successful! :man-gesturing-ok: :success-kid:'
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" }]'
- name: Trigger automerge
if: ${{ !contains(needs.*.result, 'cancelled') && !contains(needs.*.result, 'failure') && github.event.pull_request != null && github.actor == 'dependabot[bot]' && github.event.pull_request.merged == false}}
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.AUTO_MERGE_TOKEN }}
event-type: checks-complete
client-payload: '{ "prNumber": "${{ github.event.pull_request.number }}"}'