forked from orgzly-revived/orgzly-android-revived
-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (115 loc) · 4.01 KB
/
test.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
132
133
134
name: Tests
on:
pull_request:
branches:
- 'master'
paths-ignore:
- 'README.org'
- '.github/**'
- 'app/build.gradle'
- 'metadata/**'
- 'app/src/main/res/layout/dialog_whats_new.xml'
push:
branches:
- 'master'
paths-ignore:
- 'README.org'
- '.github/**'
- 'app/build.gradle'
- 'metadata/**'
- 'app/src/main/res/layout/dialog_whats_new.xml'
workflow_dispatch:
jobs:
localUnitTests:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Gradle build Fdroid
run: ./gradlew assembleFdroidDebug
- name: Gradle test Fdroid
run: ./gradlew testFdroidDebugUnitTest
- name: Add Dropbox API credentials (for DropboxRepo tests)
shell: bash
run: |
echo "dropbox.refresh_token = \"${{ secrets.DROPBOX_REFRESH_TOKEN }}\"" >> app.properties
echo "dropbox.app_key = \"${{ secrets.DROPBOX_APP_KEY }}\"" >> app.properties
- name: Gradle test Premium
run: ./gradlew testPremiumDebugUnitTest
instrumentedTests:
runs-on: ubuntu-latest
strategy:
matrix:
# TODO: Run on lowest and highest supported API
api-level: [29, 34]
flavor: [Fdroid, Premium]
steps:
- name: checkout
uses: actions/checkout@v4
- 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: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
save-always: true
- 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 }}
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
disable-spellchecker: true
profile: Nexus 6
script: echo "Generated AVD snapshot for caching."
- name: Save AVD to cache
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
- name: Add Dropbox API credentials
shell: bash
run: |
echo "dropbox.refresh_token = \"${{ secrets.DROPBOX_REFRESH_TOKEN }}\"" >> app.properties
echo "dropbox.app_key = \"${{ secrets.DROPBOX_APP_KEY }}\"" >> app.properties
- name: Run instrumented tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -metrics-collection
disable-animations: true
disable-spellchecker: true
profile: Nexus 6
# Tests should use the build which includes Dropbox code.
script: ./gradlew --no-configuration-cache connected${{matrix.flavor}}DebugAndroidTest --no-watch-fs --build-cache --info