-
-
Notifications
You must be signed in to change notification settings - Fork 446
135 lines (120 loc) · 4.29 KB
/
ci.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
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
automated-tests:
name: Automated tests
strategy:
matrix:
api-level: [ 25, 30, 33, 34 ]
fail-fast: true
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Restore Cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-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: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: default
arch: x86_64
profile: pixel_2
ram-size: 3072M
force-avd-creation: false
sdcard-path-or-size: 1024M
cores: 4
disable-animations: false
heap-size: 512M
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
channel: canary
script: echo "Generated AVD snapshot for caching."
- name: create instrumentation coverage
uses: reactivecircus/android-emulator-runner@v2
env:
GRADLE_OPTS: "-Dorg.gradle.internal.http.connectionTimeout=60000 -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.network.retry.max.attempts=6 -Dorg.gradle.internal.network.retry.initial.backOff=2000"
with:
api-level: ${{ matrix.api-level }}
target: default
arch: x86_64
profile: pixel_2
ram-size: 3072M
cores: 4
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
sdcard-path-or-size: 1024M
disable-animations: true
force-avd-creation: false
heap-size: 512M
emulator-boot-timeout: 1200
script: bash contrib/instrumentation.sh
- name: Test custom app
uses: reactivecircus/android-emulator-runner@v2
env:
GRADLE_OPTS: "-Dorg.gradle.internal.http.connectionTimeout=60000 -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.network.retry.max.attempts=6 -Dorg.gradle.internal.network.retry.initial.backOff=2000"
with:
api-level: ${{ matrix.api-level }}
target: default
arch: x86_64
profile: pixel_2
ram-size: 3072M
cores: 4
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
force-avd-creation: false
sdcard-path-or-size: 1024M
emulator-boot-timeout: 1200
heap-size: 512M
script: bash contrib/instrumentation-customapps.sh
- name: Upload screenshot result
uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.api-level }}
path: screencap.png
- name: create unit coverage
if: ${{ matrix.api-level==25 }}
run: ./gradlew testDebugUnitTest testCustomexampleDebugUnitTest
- name: Upload coverage to Codecov
if: ${{ matrix.api-level==25 }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload Coverage to GH-Actions
uses: actions/upload-artifact@v3
if: ${{ matrix.api-level==25 }}
with:
name: Tests Coverage Report
path: |
**/reports/