Skip to content

Commit 0babfc3

Browse files
add instrumented tests
1 parent ebfeaf4 commit 0babfc3

22 files changed

Lines changed: 840 additions & 259 deletions

.github/copilot-instructions.md

Lines changed: 0 additions & 194 deletions
This file was deleted.

.github/workflows/android-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
paths-ignore:
66
- '**/*.md'
77
- '.github/workflows/android-test-ci.yml'
8+
- '.github/workflows/android-emulator-test.yml'
89
- '.github/workflows/codeql-analysis.yml'
910
- '.github/workflows/close-empty-xml.yml'
1011
- '.github/workflows/stale.yml'
@@ -13,6 +14,7 @@ on:
1314
paths-ignore:
1415
- '**/*.md'
1516
- '.github/workflows/android-test-ci.yml'
17+
- '.github/workflows/android-emulator-test.yml'
1618
- '.github/workflows/codeql-analysis.yml'
1719
- '.github/workflows/close-empty-xml.yml'
1820
- '.github/workflows/stale.yml'
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Android Emulator Tests
2+
on:
3+
workflow_run:
4+
workflows: ["Android CI"]
5+
types:
6+
- completed
7+
branches:
8+
- main
9+
workflow_dispatch: {}
10+
11+
jobs:
12+
test:
13+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
api-level: [29, 31, 35]
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: ./.github/actions/common-setup
22+
- name: Enable KVM
23+
run: |
24+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
25+
sudo udevadm control --reload-rules
26+
sudo udevadm trigger --name-match=kvm
27+
- name: Gradle cache
28+
uses: gradle/actions/setup-gradle@v4
29+
- name: AVD cache
30+
uses: actions/cache@v4
31+
id: avd-cache
32+
with:
33+
path: |
34+
~/.android/avd/*
35+
~/.android/adb*
36+
key: avd-${{ matrix.api-level }}
37+
- name: Create AVD and generate snapshot for caching
38+
if: steps.avd-cache.outputs.cache-hit != 'true'
39+
uses: reactivecircus/android-emulator-runner@v2
40+
with:
41+
api-level: ${{ matrix.api-level }}
42+
arch: x86_64
43+
force-avd-creation: false
44+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
45+
disable-animations: true
46+
script: echo "Generated AVD snapshot for caching."
47+
- name: Run instrumented tests
48+
uses: reactivecircus/android-emulator-runner@v2
49+
with:
50+
api-level: ${{ matrix.api-level }}
51+
arch: x86_64
52+
force-avd-creation: false
53+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
54+
disable-animations: true
55+
script: ./gradlew connectedDebugAndroidTest
56+
- name: Upload test results
57+
uses: actions/upload-artifact@v4
58+
if: always()
59+
with:
60+
name: test-results-${{ matrix.api-level }}
61+
path: app/build/reports/androidTests
62+
- name: Publish test results
63+
uses: mikepenz/action-junit-report@v5
64+
if: always()
65+
with:
66+
report_paths: 'app/build/outputs/androidTest-results/connected/**/*.xml'

.github/workflows/android-test-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
paths-ignore:
77
- '**/*.md'
88
- '.github/workflows/android-ci.yml'
9+
- '.github/workflows/android-emulator-test.yml'
910
- '.github/workflows/codeql-analysis.yml'
1011
- '.github/workflows/close-empty-xml.yml'
1112
- '.github/workflows/stale.yml'

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ libs
1212
release
1313
*IntegrationTest.java
1414
*IntegrationTest.kt
15-
androidkeystore*
15+
androidkeystore*
16+
plans

0 commit comments

Comments
 (0)