-
-
Notifications
You must be signed in to change notification settings - Fork 89
214 lines (206 loc) · 6.32 KB
/
android.yaml
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
name: Android
on:
push:
branches:
- main
- "[0-9]+.[0-9]+.x"
tags:
- "[0-9]+.[0-9]+.[0-9]+"
paths:
- ".github/workflows/android.yaml"
- "api-client/**"
- "app/**"
- "gradle/**"
- "**.gradle"
- "gradle.properties"
- "gradlew"
- "gradlew.bat"
pull_request:
branches:
- main
- "[0-9]+.[0-9]+.x"
paths:
- ".github/workflows/android.yaml"
- "api-client/**"
- "app/**"
- "gradle/**"
- "**.gradle"
- "gradle.properties"
- "gradlew"
- "gradlew.bat"
env:
JAVA_VERSION: 17
jobs:
validate-gradle-wrapper:
name: Validate Gradle Wrapper
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
cache: gradle
- run: ./gradlew :api-client:lintDebug :app:lintFreeDebug :app:lintFullDebug --no-daemon
- if: ${{ always() }}
uses: yutailang0119/action-android-lint@v4
with:
report-path: "**/build/reports/*.xml"
api-client-unit-tests:
name: API Client Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
cache: gradle
- run: ./gradlew :api-client:testDebugCoverage --no-daemon
- uses: codecov/codecov-action@v4
with:
flags: api-client
files: api-client/build/reports/jacoco/testDebugCoverage/testDebugCoverage.xml
app-unit-tests:
name: App Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
cache: gradle
- run: ./gradlew :app:testDebugCoverage --no-daemon
- uses: codecov/codecov-action@v4
with:
flags: app
files: app/build/reports/jacoco/testFreeDebugCoverage/testFreeDebugCoverage.xml,app/build/reports/jacoco/testFullDebugCoverage/testFullDebugCoverage.xml
app-ui-tests:
name: App UI tests
runs-on: macos-latest
timeout-minutes: 60
strategy:
matrix:
include:
- android: 30
target: aosp_atd
appVariant: FreeDebug
- android: 30
target: google_atd
appVariant: FullDebug
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
cache: gradle
- run: ./gradlew :app:assemble${{ matrix.appVariant }}AndroidTest # build before starting the emulator.
- uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.android }}
target: ${{ matrix.target }}
arch: x86_64
script: ./scripts/run-ui-tests.sh :app:create${{ matrix.appVariant }}CoverageReport
emulator-options: >-
-camera-back none -camera-front none -gpu swiftshader_indirect
-memory 3000 -no-audio -no-boot-anim -no-snapshot -no-window
- uses: codecov/codecov-action@v4
with:
flags: app
deploy-app-play-store:
name: Deploy App - Play Store
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs:
- validate-gradle-wrapper
- lint
- api-client-unit-tests
- app-unit-tests
- app-ui-tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
cache: gradle
- run: bundle install
- run: |
echo "$SERVICE_ACCOUNT_KEY" > service-account-key.json
echo "$JKS_STORE" | base64 --decode > keystore.jks
env:
SERVICE_ACCOUNT_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }}
JKS_STORE: ${{ secrets.JKS_STORE }}
- run: bundle exec fastlane beta
env:
STORE_PASSWORD: ${{ secrets.JKS_STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.JKS_ALIAS }}
KEY_PASSWORD: ${{ secrets.JKS_ALIAS_PASSWORD }}
- if: ${{ always() }}
run: rm -f service-account-key.json keystore.jks
deploy-app-github:
name: Deploy App - GitHub
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs:
- validate-gradle-wrapper
- lint
- api-client-unit-tests
- app-unit-tests
- app-ui-tests
runs-on: ubuntu-latest
timeout-minutes: 30
env:
FULL_APK: noice-full.apk
FULL_MAPPING: noice-full-mapping.txt
FREE_APK: noice-free.apk
FREE_MAPPING: noice-free-mapping.txt
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
cache: gradle
- run: git fetch --prune --unshallow --tags -f
- run: ./scripts/create-github-release-artifacts.sh
env:
JKS_STORE: ${{ secrets.JKS_STORE }}
STORE_PASSWORD: ${{ secrets.JKS_STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.JKS_ALIAS }}
KEY_PASSWORD: ${{ secrets.JKS_ALIAS_PASSWORD }}
- id: tag_info
run: |
export TAG_NAME="${GITHUB_REF/'refs/tags/'/''}"
{
echo "name=$TAG_NAME";
echo "body<<EOF";
git tag --list --format='%(contents:body)' $TAG_NAME;
echo "EOF";
} >> "$GITHUB_OUTPUT"
- uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.BOT_PAT }}
name: v${{ steps.tag_info.outputs.name }}
body: ${{ steps.tag_info.outputs.body }}
files: |
${{ env.FREE_APK }}
${{ env.FREE_MAPPING }}
${{ env.FULL_APK }}
${{ env.FULL_MAPPING }}