-
Notifications
You must be signed in to change notification settings - Fork 30
341 lines (289 loc) · 13.6 KB
/
main.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
name: CCC CI
on:
push:
branches:
- develop
pull_request:
schedule:
- cron: '0 0 * * *' # At 00:00 every day
concurrency:
group: ${{ github.ref == 'refs/heads/develop' && 'develop' || github.ref }} # Only run one job at a time for the same branch
cancel-in-progress: ${{ github.ref != 'refs/heads/develop' }} # Only cancel the same branch but not develop
env:
BASE_URL_BACKEND: ${{ secrets.BASE_URL_BACKEND }}
BASE_URL_API: ${{ secrets.BASE_URL_API }}
BASE_URL_API_PREMIUM: ${{ secrets.BASE_URL_API_PREMIUM }}
API_KEY_PREMIUM: ${{ secrets.API_KEY_PREMIUM }}
ANDROID_KEY_STORE_PATH: ${{ secrets.ANDROID_KEY_STORE_PATH }}
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
RELEASE_ADVERTISEMENT_ID_GOOGLE: ${{ secrets.RELEASE_ADVERTISEMENT_ID_GOOGLE }}
DEBUG_ADVERTISEMENT_ID_GOOGLE: ${{ secrets.DEBUG_ADVERTISEMENT_ID_GOOGLE }}
RELEASE_ADVERTISEMENT_ID_HUAWEI: ${{ secrets.RELEASE_ADVERTISEMENT_ID_HUAWEI }}
DEBUG_ADVERTISEMENT_ID_HUAWEI: ${{ secrets.DEBUG_ADVERTISEMENT_ID_HUAWEI }}
GOOGLE_BANNER_AD_UNIT_ID_CALCULATOR_RELEASE: ${{ secrets.GOOGLE_BANNER_AD_UNIT_ID_CALCULATOR_RELEASE }}
GOOGLE_BANNER_AD_UNIT_ID_SETTINGS_RELEASE: ${{ secrets.GOOGLE_BANNER_AD_UNIT_ID_SETTINGS_RELEASE }}
GOOGLE_BANNER_AD_UNIT_ID_CURRENCIES_RELEASE: ${{ secrets.GOOGLE_BANNER_AD_UNIT_ID_CURRENCIES_RELEASE }}
GOOGLE_INTERSTITIAL_AD_ID_RELEASE: ${{ secrets.GOOGLE_INTERSTITIAL_AD_ID_RELEASE }}
GOOGLE_REWARDED_AD_UNIT_ID_RELEASE: ${{ secrets.GOOGLE_REWARDED_AD_UNIT_ID_RELEASE }}
GOOGLE_BANNER_AD_UNIT_ID_CALCULATOR_DEBUG: ${{ secrets.GOOGLE_BANNER_AD_UNIT_ID_CALCULATOR_DEBUG }}
GOOGLE_BANNER_AD_UNIT_ID_SETTINGS_DEBUG: ${{ secrets.GOOGLE_BANNER_AD_UNIT_ID_SETTINGS_DEBUG }}
GOOGLE_BANNER_AD_UNIT_ID_CURRENCIES_DEBUG: ${{ secrets.GOOGLE_BANNER_AD_UNIT_ID_CURRENCIES_DEBUG }}
GOOGLE_INTERSTITIAL_AD_ID_DEBUG: ${{ secrets.GOOGLE_INTERSTITIAL_AD_ID_DEBUG }}
GOOGLE_REWARDED_AD_UNIT_ID_DEBUG: ${{ secrets.GOOGLE_REWARDED_AD_UNIT_ID_DEBUG }}
HUAWEI_BANNER_AD_UNIT_ID_CALCULATOR_RELEASE: ${{ secrets.HUAWEI_BANNER_AD_UNIT_ID_CALCULATOR_RELEASE }}
HUAWEI_BANNER_AD_UNIT_ID_SETTINGS_RELEASE: ${{ secrets.HUAWEI_BANNER_AD_UNIT_ID_SETTINGS_RELEASE }}
HUAWEI_BANNER_AD_UNIT_ID_CURRENCIES_RELEASE: ${{ secrets.HUAWEI_BANNER_AD_UNIT_ID_CURRENCIES_RELEASE }}
HUAWEI_INTERSTITIAL_AD_ID_RELEASE: ${{ secrets.HUAWEI_INTERSTITIAL_AD_ID_RELEASE }}
HUAWEI_REWARDED_AD_UNIT_ID_RELEASE: ${{ secrets.HUAWEI_REWARDED_AD_UNIT_ID_RELEASE }}
HUAWEI_BANNER_AD_UNIT_ID_CALCULATOR_DEBUG: ${{ secrets.HUAWEI_BANNER_AD_UNIT_ID_CALCULATOR_DEBUG }}
HUAWEI_BANNER_AD_UNIT_ID_SETTINGS_DEBUG: ${{ secrets.HUAWEI_BANNER_AD_UNIT_ID_SETTINGS_DEBUG }}
HUAWEI_BANNER_AD_UNIT_ID_CURRENCIES_DEBUG: ${{ secrets.HUAWEI_BANNER_AD_UNIT_ID_CURRENCIES_DEBUG }}
HUAWEI_INTERSTITIAL_AD_ID_DEBUG: ${{ secrets.HUAWEI_INTERSTITIAL_AD_ID_DEBUG }}
HUAWEI_REWARDED_AD_UNIT_ID_DEBUG: ${{ secrets.HUAWEI_REWARDED_AD_UNIT_ID_DEBUG }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY_CONTENT: ${{ secrets.APP_STORE_CONNECT_KEY_CONTENT }}
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
IOS_RELEASE_FIREBASE_APP_ID: ${{ secrets.IOS_RELEASE_FIREBASE_APP_ID }}
IOS_DEBUG_FIREBASE_APP_ID: ${{ secrets.IOS_DEBUG_FIREBASE_APP_ID }}
FIREBASE_CLI_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}
GIT_AUTHORIZATION: ${{ secrets.GIT_AUTHORIZATION }}
SECRET_PASSWORD: ${{ secrets.SECRET_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.SECRET_PASSWORD }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 5
FASTLANE_XCODEBUILD_SETTINGS_RETRIES: 5
CI: true
BUILD_TYPE: ${{ github.event_name == 'schedule' && 'Release' || 'Debug' }}
BUILD_TYPE_LOWERCASE: ${{ github.event_name == 'schedule' && 'release' || 'debug' }}
jobs:
GradleBuild:
runs-on: macos-14
outputs:
status: ${{ steps.status.outputs.status }}
steps:
- name: Setup Gradle Repo
uses: Oztechan/Global/actions/setup-gradle-repo@d8c3bac8260f401449f8eb3abcc20c1dec90b65e
- name: Adding secret files
uses: ./.github/actions/add-secret-files
with:
ANDROID_RELEASE_KEYSTORE_ASC: ${{ secrets.ANDROID_RELEASE_KEYSTORE_ASC }}
SECRET_PASSWORD: ${{ secrets.SECRET_PASSWORD }}
GOOGLE_SERVICES_JSON_ASC: ${{ secrets.GOOGLE_SERVICES_JSON_ASC }}
AG_CONNECT_SERVICES_JSON_ASC: ${{ secrets.AG_CONNECT_SERVICES_JSON_ASC }}
GOOGLE_SERVICE_INFO_PLIST_ASC_RELEASE: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_ASC_RELEASE }}
GOOGLE_SERVICE_INFO_PLIST_ASC_DEBUG: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_ASC_DEBUG }}
IOS_XCCONFIG_ASC_RELEASE: ${{ secrets.IOS_XCCONFIG_ASC_RELEASE }}
IOS_XCCONFIG_ASC_DEBUG: ${{ secrets.IOS_XCCONFIG_ASC_DEBUG }}
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
- name: Assemble ${{ env.BUILD_TYPE }}
run: ./gradlew assemble${{ env.BUILD_TYPE }}
- name: Upload Android ${{ env.BUILD_TYPE }} Artifacts
uses: actions/[email protected]
if: github.event_name == 'push' || github.event_name == 'schedule'
with:
name: androidArtifacts
path: |
android/app/build/outputs/apk/google/${{ env.BUILD_TYPE_LOWERCASE }}/app-google-${{ env.BUILD_TYPE_LOWERCASE }}.apk
android/app/build/outputs/apk/huawei/${{ env.BUILD_TYPE_LOWERCASE }}/app-huawei-${{ env.BUILD_TYPE_LOWERCASE }}.apk
- name: Cancel other jobs if this fails
if: failure()
uses: andymckay/[email protected]
- name: Set Job Status
id: status
run: echo "status=success" >> $GITHUB_OUTPUT
DistributeAndroid:
runs-on: ubuntu-24.04
needs: [ GradleBuild ]
if: github.event_name == 'push' || github.event_name == 'schedule'
outputs:
status: ${{ steps.status.outputs.status }}
steps:
- name: Clone Repo # Needed for reading commit message for Firebase App Distribution
uses: actions/[email protected]
- name: Download Android ${{ env.BUILD_TYPE }} Artifacts
uses: actions/[email protected]
with:
name: androidArtifacts
- name: Firebase App Distribution Google ${{ env.BUILD_TYPE }}
uses: wzieba/[email protected]
with:
appId: ${{ github.event_name == 'schedule' && secrets.ANDROID_GOOGLE_RELEASE_FIREBASE_APP_ID || secrets.ANDROID_GOOGLE_DEBUG_FIREBASE_APP_ID }}
token: ${{secrets.FIREBASE_CLI_TOKEN}}
groups: QA
file: google/${{ env.BUILD_TYPE_LOWERCASE }}/app-google-${{ env.BUILD_TYPE_LOWERCASE }}.apk
- name: Firebase App Distribution Huawei ${{ env.BUILD_TYPE }}
uses: wzieba/[email protected]
with:
appId: ${{ github.event_name == 'schedule' && secrets.ANDROID_HUAWEI_RELEASE_FIREBASE_APP_ID || secrets.ANDROID_HUAWEI_DEBUG_FIREBASE_APP_ID }}
token: ${{secrets.FIREBASE_CLI_TOKEN}}
groups: QA
file: huawei/${{ env.BUILD_TYPE_LOWERCASE }}/app-huawei-${{ env.BUILD_TYPE_LOWERCASE }}.apk
- name: Delete Android ${{ env.BUILD_TYPE }} Artifacts
uses: geekyeggo/[email protected]
with:
name: androidArtifacts
- name: Set Job Status
id: status
run: echo "status=success" >> $GITHUB_OUTPUT
XCodeBuild:
runs-on: macos-14
outputs:
status: ${{ steps.status.outputs.status }}
steps:
- name: Setup Gradle Repo
uses: Oztechan/Global/actions/setup-gradle-repo@d8c3bac8260f401449f8eb3abcc20c1dec90b65e
- name: Adding secret files
uses: ./.github/actions/add-secret-files
with:
ANDROID_RELEASE_KEYSTORE_ASC: ${{ secrets.ANDROID_RELEASE_KEYSTORE_ASC }}
SECRET_PASSWORD: ${{ secrets.SECRET_PASSWORD }}
GOOGLE_SERVICES_JSON_ASC: ${{ secrets.GOOGLE_SERVICES_JSON_ASC }}
AG_CONNECT_SERVICES_JSON_ASC: ${{ secrets.AG_CONNECT_SERVICES_JSON_ASC }}
GOOGLE_SERVICE_INFO_PLIST_ASC_RELEASE: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_ASC_RELEASE }}
GOOGLE_SERVICE_INFO_PLIST_ASC_DEBUG: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_ASC_DEBUG }}
IOS_XCCONFIG_ASC_RELEASE: ${{ secrets.IOS_XCCONFIG_ASC_RELEASE }}
IOS_XCCONFIG_ASC_DEBUG: ${{ secrets.IOS_XCCONFIG_ASC_DEBUG }}
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
- name: Build ${{ env.BUILD_TYPE }}
working-directory: ios
run: fastlane build${{ env.BUILD_TYPE }}
- name: Upload iOS Debug Artifacts
uses: actions/[email protected]
if: github.event_name == 'push'
with:
name: iOSArtifacts
path: |
ios/CCC_I.ipa
ios/CCC_I.app.dSYM.zip
- name: Upload iOS Artifacts
uses: actions/[email protected]
if: github.event_name == 'schedule'
with:
name: iOSArtifacts
path: |
ios/CCC.ipa
ios/CCC.app.dSYM.zip
- name: Cancel other jobs if this fails
if: failure()
uses: andymckay/[email protected]
- name: Set Job Status
id: status
run: echo "status=success" >> $GITHUB_OUTPUT
DistributeIOS:
runs-on: ubuntu-24.04
needs: [ XCodeBuild ]
if: github.event_name == 'push' || github.event_name == 'schedule'
outputs:
status: ${{ steps.status.outputs.status }}
steps:
- name: Clone Repo
uses: actions/[email protected]
- name: Download iOS ${{ env.BUILD_TYPE }} Artifacts
uses: actions/[email protected]
with:
name: iOSArtifacts
path: ios
# was necessary to use chown to fix permission issues in linux machines
- name: Distribute ${{ env.BUILD_TYPE }}
working-directory: ios
run: |
sudo chown -R $(whoami) /var/lib/gems/
fastlane distribute${{ env.BUILD_TYPE }}
- name: Delete iOS ${{ env.BUILD_TYPE }} Artifacts
uses: geekyeggo/[email protected]
with:
name: iOSArtifacts
- name: Set Job Status
id: status
run: echo "status=success" >> $GITHUB_OUTPUT
Test:
runs-on: macos-14
outputs:
status: ${{ steps.status.outputs.status }}
steps:
- name: Setup Gradle Repo
uses: Oztechan/Global/actions/setup-gradle-repo@d8c3bac8260f401449f8eb3abcc20c1dec90b65e
- name: Test
run: ./gradlew test
- name: Cancel other jobs if this fails
if: failure()
uses: andymckay/[email protected]
- name: Set Job Status
id: status
run: echo "status=success" >> $GITHUB_OUTPUT
Coverage:
runs-on: ubuntu-24.04
outputs:
status: ${{ steps.status.outputs.status }}
steps:
- name: Setup Gradle Repo
uses: Oztechan/Global/actions/setup-gradle-repo@d8c3bac8260f401449f8eb3abcc20c1dec90b65e
- name: Generate Coverage
run: ./gradlew koverXmlReport
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: build/reports/kover/report.xml
- name: Upload coverage to Codacy
uses: codacy/[email protected]
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: build/reports/kover/report.xml
- name: SonarCloud Scan
uses: sonarsource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=oztechan
-Dsonar.projectKey=Oztechan_CCC
-Dsonar.coverage.jacoco.xmlReportPaths=build/reports/kover/report.xml
- name: Cancel other jobs if this fails
if: failure()
uses: andymckay/[email protected]
- name: Set Job Status
id: status
run: echo "status=success" >> $GITHUB_OUTPUT
CodeAnalysis:
runs-on: ubuntu-24.04
outputs:
status: ${{ steps.status.outputs.status }}
steps:
- name: Setup Gradle Repo
uses: Oztechan/Global/actions/setup-gradle-repo@d8c3bac8260f401449f8eb3abcc20c1dec90b65e
- name: Detekt & Lint
run: ./gradlew detektAll lint
- name: SwiftLint
uses: norio-nomura/[email protected]
env:
WORKING_DIRECTORY: ios
with:
args: --strict
- name: Cancel other jobs if this fails
if: failure()
uses: andymckay/[email protected]
- name: Set Job Status
id: status
run: echo "status=success" >> $GITHUB_OUTPUT
Notify:
runs-on: ubuntu-24.04
needs: [ GradleBuild, XCodeBuild, Test, Coverage, CodeAnalysis, DistributeAndroid, DistributeIOS ]
if: always()
steps:
- name: Notify slack fail
if: false == (needs.GradleBuild.outputs.status == 'success') ||
false == (needs.XCodeBuild.outputs.status == 'success') ||
false == (needs.Test.outputs.status == 'success') ||
false == (needs.Coverage.outputs.status == 'success') ||
false == (needs.CodeAnalysis.outputs.status == 'success') ||
(false == (needs.DistributeAndroid.outputs.status == 'success') && (github.event_name == 'push' || github.event_name == 'schedule')) ||
(false == (needs.DistributeIOS.outputs.status == 'success') && (github.event_name == 'push' || github.event_name == 'schedule'))
uses: voxmedia/[email protected]
with:
channel: ccc-github
status: FAILED
color: danger