-
-
Notifications
You must be signed in to change notification settings - Fork 480
131 lines (127 loc) · 5.56 KB
/
espresso.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
---
"on":
workflow_call:
jobs:
espresso-test:
name: "Espresso tests"
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
strategy:
fail-fast: false
matrix:
android-api: [31]
flavour: [Gms, Oss]
shard: [1, 2, 3, 4, 5, 6]
steps:
- name: Enable KVM group perms
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: Remove unused things
run: |
sudo rm -rf /opt/ghc # Haskell
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/share/dotnet
sudo docker image prune --all --force
sudo df -h
# Github charges us for LFS bandwidth, so let's use the cache
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
lfs: false
- name: Create LFS file list
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
- name: Restore LFS cache
uses: actions/cache@v4
id: lfs-cache
with:
path: .git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1
- name: Git LFS Pull
run: git lfs pull
- uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4
with:
distribution: "temurin" # See 'Supported distributions' for available options
java-version: "17"
- name: Gradle setup
uses: gradle/actions/setup-gradle@v4
with:
dependency-graph: generate
cache-encryption-key: ${{ secrets.GradleEncryptionKey }}
- name: AVD cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: owntracks-test-${{ matrix.android-api }}-${{ matrix.flavour }}
- name: Create AVD and generate snapshot for caching
timeout-minutes: 10
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.android-api }}
force-avd-creation: false
emulator-options: -no-window -gpu auto -noaudio -no-boot-anim -camera-back none -camera-front none -memory 6000
profile: pixel_3a
target: ${{ matrix.flavour == 'Gms' && 'google_apis' || 'default' }}
ram-size: 6000M
avd-name: owntracks-test-${{ matrix.android-api }}-${{ matrix.flavour }}
disable-animations: true
arch: x86_64
cores: 2
sdcard-path-or-size: 1000M
script: |
echo "Created AVD snapshot"
- name: Espresso Test
uses: reactivecircus/android-emulator-runner@v2
timeout-minutes: 30
env:
FLAVOUR: ${{ matrix.flavour }}
SHARD_COUNT: 6
SHARD_INDEX: ${{ matrix.shard }}
GRADLE_OPTS: "-Dorg.gradle.daemon=true -Dorg.gradle.configuration-cache=true -Dorg.gradle.parallel=true -Dorg.gradle.caching=true -Dorg.gradle.jvmargs='-Xmx3096M -Dkotlin.daemon.jvm.options=-Xmx2048M -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC'"
with:
api-level: ${{ matrix.android-api }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu auto -noaudio -no-boot-anim -camera-back none -camera-front none -memory 6000
profile: pixel_3a
target: ${{ matrix.flavour == 'Gms' && 'google_apis' || 'default' }}
ram-size: 6000M
disable-animations: true
avd-name: owntracks-test-${{ matrix.android-api }}-${{ matrix.flavour }}
arch: x86_64
cores: 2
sdcard-path-or-size: 1000M
script: |
adb shell settings put global bluetooth_on 0
adb shell settings put secure long_press_timeout 1000
adb shell rm -rf /sdcard/googletest || echo "Couldn't delete googletest folder"
adb uninstall org.owntracks.android.debug || echo "org.owntracks.android not installed"
adb uninstall org.owntracks.android.debug.test || echo "org.owntracks.android.test not installed"
./project/gradlew -p project :app:create${FLAVOUR}DebugAndroidTestCoverageReport -Pandroid.testInstrumentationRunnerArguments.numShards=${SHARD_COUNT} -Pandroid.testInstrumentationRunnerArguments.shardIndex=${SHARD_INDEX} --max-workers=1 --scan
- name: Upload connected test result artifact
uses: actions/upload-artifact@v4
with:
name: espresso-test-reports-${{ matrix.android-api }}-${{ matrix.flavour }}-${{ matrix.shard }}
path: ./project/app/build/reports/androidTests/connected/
- name: Espresso JUnit Report
uses: mikepenz/action-junit-report@v4
if: always()
with:
report_paths: "**/TEST-*.xml"
detailed_summary: true
include_passed: false
- name: Upload connected test coverage artifact
uses: ./.github/actions/upload-artifact
with:
name: espresso-test-coverage-${{ matrix.android-api }}-${{ matrix.flavour }}-${{ matrix.shard }}
path: ./project/app/build/reports/coverage/androidTest/
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
files: ./project/app/build/reports/coverage/androidTest/${{ matrix.flavour == 'Gms' && 'gms' || 'oss' }}/debug/connected/report.xml
flags: uitests
token: ${{ secrets.CODECOV_TOKEN }}