-
Notifications
You must be signed in to change notification settings - Fork 4
174 lines (168 loc) · 6.42 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
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
name: Android CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
checks:
name: Checks
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
cache: 'gradle'
- run: chmod +x gradlew
- uses: gradle/actions/setup-gradle@v3
- run: ./gradlew lintKotlin
- run: ./gradlew lint
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
cache: 'gradle'
- run: chmod +x gradlew
- uses: gradle/actions/setup-gradle@v3
- run: ./gradlew yorkie:testDebugUnitTest
- run: ./gradlew yorkie:jacocoDebugTestReport
- uses: actions/upload-artifact@v4
with:
name: unit-test-artifact
path: yorkie/build/reports/jacoco/jacocoDebugTestReport/jacocoDebugTestReport.xml
instrumentation-tests:
name: Instrumentation tests
strategy:
fail-fast: false
matrix:
api-level: [ 24 ]
target: [ google_apis ]
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
cache: 'gradle'
- run: chmod +x gradlew
- uses: gradle/actions/setup-gradle@v3
- run: |
docker system prune --all --force
docker-compose -f docker/docker-compose-ci.yml up --build -d
- uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-${{ matrix.target }}-x86_64-4096m
- if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
ram-size: 4096M
emulator-boot-timeout: 12000
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
ram-size: 4096M
emulator-boot-timeout: 12000
disable-animations: true
script: |
adb shell pm list packages | grep dev.yorkie.test && adb uninstall dev.yorkie.test || true;
./gradlew yorkie:connectedCheck -Pandroid.testInstrumentationRunnerArguments.notAnnotation=dev.yorkie.TreeTest --no-build-cache --no-daemon --stacktrace
./gradlew yorkie:connectedCheck -Pandroid.testInstrumentationRunnerArguments.annotation=dev.yorkie.TreeBasicTest --no-build-cache --no-daemon --stacktrace
./gradlew yorkie:connectedCheck -Pandroid.testInstrumentationRunnerArguments.annotation=dev.yorkie.TreeSplitMergeTest --no-build-cache --no-daemon --stacktrace
- if: ${{ matrix.api-level == 24 }}
run: ./gradlew yorkie:jacocoDebugTestReport
- if: ${{ matrix.api-level == 24 }}
uses: actions/upload-artifact@v4
with:
name: android-test-artifact
path: yorkie/build/reports/jacoco/jacocoDebugTestReport/jacocoDebugTestReport.xml
codecov:
name: Codecov
needs: [ unit-tests, instrumentation-tests ]
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v2
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: false
microbenchmarks:
name: Microbenchmarks
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
cache: 'gradle'
- run: chmod +x gradlew
- uses: gradle/actions/setup-gradle@v3
- uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-30-google_apis-x86_64-4096m
- if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 32
target: google_apis
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
ram-size: 4096M
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 32
target: google_apis
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
ram-size: 4096M
disable-animations: true
script: |
./gradlew microbenchmark:assembleReleaseAndroidTest;
adb shell pm list packages | grep dev.yorkie.microbenchmark.test && adb uninstall dev.yorkie.microbenchmark.test || true;
adb install microbenchmark/build/outputs/apk/androidTest/release/microbenchmark-release-androidTest.apk;
adb shell am instrument -w -e no-isolated-storage true -e additionalTestOutputDir /sdcard/Download/ -e "androidx.benchmark.suppressErrors" "EMULATOR,LOW-BATTERY,UNLOCKED" dev.yorkie.microbenchmark.test/androidx.benchmark.junit4.AndroidBenchmarkRunner;
adb shell find /sdcard/Download -name "*-benchmarkData.json" | tr -d '\r' | xargs -n1 adb pull
- run: |
echo "$(cat dev.yorkie.microbenchmark.test-benchmarkData.json)"
- uses: actions/upload-artifact@v4
with:
name: microbenchmark-artifact
path: dev.yorkie.microbenchmark.test-benchmarkData.json