-
-
Notifications
You must be signed in to change notification settings - Fork 0
213 lines (172 loc) · 6.36 KB
/
android.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
name: Android
on:
pull_request:
branches:
- main
paths-ignore:
- '**/*.md'
- 'ios/**'
push:
branches:
- main
tags:
- android-[0-9]+.[0-9]+.[0-9]+
paths-ignore:
- '**/*.md'
- 'ios/**'
env:
CI: true
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xms4g -Xmx4g -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError"
TERM: dumb
jobs:
assemble:
name: Assemble
runs-on: ubuntu-latest
timeout-minutes: 15
env:
ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }}
KSTREAMLINED_KEY_ALIAS: ${{ secrets.KSTREAMLINED_KEY_ALIAS }}
KSTREAMLINED_KEY_PASSWORD: ${{ secrets.KSTREAMLINED_KEY_PASSWORD }}
KSTREAMLINED_STORE_PASSWORD: ${{ secrets.KSTREAMLINED_STORE_PASSWORD }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '21'
- name: Decrypt secrets
run: |
mkdir android/app/src/dev && mkdir android/app/src/prod
openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -salt -in android/secrets/kstreamlined.aes -out android/secrets/kstreamlined.jks -k $ENCRYPTION_KEY
openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -salt -in android/secrets/android-google-services-dev.aes -out android/app/src/dev/google-services.json -k $ENCRYPTION_KEY
openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -salt -in android/secrets/android-google-services-prod.aes -out android/app/src/prod/google-services.json -k $ENCRYPTION_KEY
- uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Assemble dev debug APK and signed release App Bundle
run: ./gradlew app:assembleDevDebug app:bundleProdRelease
- name: Cleanup secrets
if: always()
run: |
rm -f android/secrets/kstreamlined.jks
rm -f android/app/src/dev/google-services.json
rm -f android/app/src/prod/google-services.json
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-outputs
path: android/app/build/outputs/
retention-days: 7
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
timeout-minutes: 15
env:
ENABLE_APP_VERSIONING: false
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '21'
- uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Run unit tests
run: ./gradlew test jvmTest -PslimTests
static-analysis:
name: Static analysis
runs-on: ubuntu-latest
timeout-minutes: 15
env:
ENABLE_APP_VERSIONING: false
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '21'
- uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Run detekt, ktlint and Android Lint
run: |
./gradlew detekt lint
./gradlew -p build-logic detekt
deploy-dev-build:
name: Upload dev build
needs: [ assemble, unit-tests, static-analysis ]
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/android')
runs-on: ubuntu-latest
timeout-minutes: 15
env:
ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }}
ENABLE_APP_VERSIONING: false
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '21'
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-outputs
path: android/app/build/outputs
- name: Decrypt secrets
run: |
mkdir android/app/src/dev
openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -salt -in secrets/firebase-key.aes -out secrets/firebase-key.json -k $ENCRYPTION_KEY
openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -salt -in android/secrets/android-google-services-dev.aes -out android/app/src/dev/google-services.json -k $ENCRYPTION_KEY
- uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Publish dev build to Firebase App Distribution
run: ./gradlew processDevDebugGoogleServices appDistributionUploadDevDebug
- name: Cleanup secrets
if: always()
run: |
rm -f secrets/firebase-key.json
rm -f android/app/src/dev/google-services.json
deploy-release-build:
name: Publish release build to Play Store (internal test track)
needs: [ assemble, unit-tests, static-analysis ]
if: startsWith(github.ref, 'refs/tags/android')
runs-on: ubuntu-latest
timeout-minutes: 15
env:
ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }}
ENABLE_APP_VERSIONING: false
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '21'
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-outputs
path: android/app/build/outputs
- name: Decrypt secrets
run: |
mkdir android/app/src/prod
openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -salt -in android/secrets/play-publishing.aes -out android/secrets/play-publishing.json -k $ENCRYPTION_KEY
openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -salt -in android/secrets/android-google-services-prod.aes -out android/app/src/prod/google-services.json -k $ENCRYPTION_KEY
- uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Publish release App Bundle to Play Store
run: ./gradlew publishBundle --artifact-dir android/app/build/outputs/bundle/prodRelease
- name: Cleanup secrets
if: always()
run: |
rm -f android/secrets/play-publishing.json
rm -f android/app/src/prod/google-services.json