-
Notifications
You must be signed in to change notification settings - Fork 46
208 lines (178 loc) · 5.66 KB
/
Copy pathbuild.yml
File metadata and controls
208 lines (178 loc) · 5.66 KB
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
name: Pull request checks
on:
pull_request:
types:
- opened
- reopened
- synchronize
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
build-debug-apk:
name: Build debug APK
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out sources
uses: actions/checkout@v6
with:
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
cache: gradle
- name: Assemble debug APK
run: ./gradlew :app:assembleDebug --no-daemon --stacktrace --console=plain
ktlint:
name: ktlintCheck
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out sources
uses: actions/checkout@v6
with:
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
cache: gradle
- name: Run ktlintCheck
run: ./gradlew ktlintCheck --no-daemon --stacktrace --console=plain
- name: Upload ktlint reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: ktlint-reports
path: |
build/reports/ktlint/
app/build/reports/ktlint/
if-no-files-found: ignore
detekt:
name: Detekt
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out sources
uses: actions/checkout@v6
with:
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
cache: gradle
- name: Run Detekt
run: ./gradlew :app:detekt --no-daemon --stacktrace --console=plain
- name: Upload Detekt reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: detekt-reports
path: app/build/reports/detekt/
if-no-files-found: ignore
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out sources
uses: actions/checkout@v6
with:
submodules: true
- name: Set up JDKs
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: |
17
21
cache: gradle
- name: Run unit tests and coverage gate
run: >
./gradlew :app:jacocoUnitTestVerification
-PunitTestMinCoverage=80
-PunitTestMinBranchCoverage=60
--no-daemon --stacktrace --console=plain
- name: Upload unit test reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: unit-test-reports
path: |
app/build/reports/jacoco/jacocoUnitTestReport/
app/build/reports/tests/testDebugUnitTest/
app/build/test-results/testDebugUnitTest/
if-no-files-found: ignore
instrumented-tests:
name: Instrumented tests (Android 16 x86_64)
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Check out sources
uses: actions/checkout@v6
with:
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
cache: gradle
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Restore AVD cache
id: avd-cache
uses: actions/cache@v4
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-36-x86_64-default
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d
with:
api-level: 36
arch: x86_64
target: default
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Run instrumented tests and coverage gate
uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d
with:
api-level: 36
arch: x86_64
target: default
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: >
./gradlew :app:connectedDebugAndroidTest :app:jacocoAndroidTestVerification
-PandroidTestCoverage=true
-PandroidTestMinCoverage=80
-PandroidTestMinBranchCoverage=50
--no-daemon --stacktrace --console=plain
- name: Upload instrumented test reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: instrumented-test-reports
path: |
app/build/outputs/code_coverage/debugAndroidTest/connected/
app/build/outputs/androidTest-results/connected/
app/build/reports/jacoco/jacocoAndroidTestReport/
app/build/reports/androidTests/connected/
if-no-files-found: ignore