This repository was archived by the owner on May 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
130 lines (115 loc) · 4.94 KB
/
Copy pathtests.yml
File metadata and controls
130 lines (115 loc) · 4.94 KB
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
name: Tests
on:
push:
branches:
- 'main'
pull_request:
concurrency:
group: test-dev-${{ github.ref }}
cancel-in-progress: true
jobs:
compile:
name: Compile and cache
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21 # keep in sync with gradle/gradle-daemon-jvm.properties
# See https://community.gradle.org/github-actions/docs/setup-gradle/ for more information
- uses: gradle/actions/setup-gradle@v6 # creates build cache when on main branch
with:
cache-encryption-key: ${{ secrets.gradle_encryption_key }}
dependency-graph: generate-and-submit # submit Github Dependency Graph info
- run: ./gradlew --build-cache --configuration-cache compileDebugSources
test:
needs: compile
if: ${{ !cancelled() }} # even if compile didn't run (because not on main branch)
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21 # keep in sync with gradle/gradle-daemon-jvm.properties
- uses: gradle/actions/setup-gradle@v6
with:
cache-encryption-key: ${{ secrets.gradle_encryption_key }}
cache-read-only: true
- name: Run lint
run: ./gradlew --build-cache --configuration-cache lintDebug
- name: Run unit tests
run: ./gradlew --build-cache --configuration-cache testDebugUnitTest
test_on_emulator:
needs: compile
if: ${{ !cancelled() }} # even if compile didn't run (because not on main branch)
name: Instrumented tests (API ${{ matrix.api-level }})
runs-on: ubuntu-latest
strategy:
matrix:
api-level:
# - 24 # Android 7 (minSdk level; not supported by gradle-managed devices)
# - 27 # the lowest supported version by GMD; doesn't work for some reason
- 30 # Android 11 # Android 11 is the latest version where calendar provider doesn't match millisecond occurrences of recurring events
- 32 # Android 12L # Android 12 is the first version where calendar provider matches millisecond occurrences of recurring events
- 35 # Android 15 # use latest SDK that has an AOSP image here
env:
apk-dir: lib/apk
fdroid-packages: "at.techbee.jtx org.dmfs.tasks org.tasks"
API_LEVEL: ${{ matrix.api-level }}
steps:
- uses: gradle/actions/setup-gradle@v6
with:
cache-encryption-key: ${{ secrets.gradle_encryption_key }}
cache-read-only: true
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21 # keep in sync with gradle/gradle-daemon-jvm.properties
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Restore F-Droid APKs from cache
uses: actions/cache/restore@v5
with:
path: ${{ env.apk-dir }}
key: fdroid-apks
restore-keys: | # restore nearest cache (regardless of the hash)
fdroid-apks-
- name: Download F-Droid packages
continue-on-error: true
run: |
mkdir -p ${{ env.apk-dir }}
for pkg in ${{ env.fdroid-packages }}; do
# Get package info from F-Droid API
api_url="https://f-droid.org/api/v1/packages/$pkg"
response=$(curl -s "$api_url")
# Extract package name and suggested version code
package_name=$(echo "$response" | jq -r '.packageName')
suggested_version_code=$(echo "$response" | jq -r '.suggestedVersionCode')
if [ -z "$package_name" ] || [ "$package_name" == "null" ]; then
echo "Error: Could not get package info for $pkg"
continue
fi
# Download the APK using ETag-based caching
apk_url="https://f-droid.org/repo/${package_name}_${suggested_version_code}.apk"
apk_file="${{ env.apk-dir }}/${package_name}_latest.apk"
etag_file="${apk_file}.etag"
echo "Downloading $apk_url -> $apk_file"
curl --etag-compare "$etag_file" --etag-save "$etag_file" -Lo "$apk_file" "$apk_url" || true
done
- name: Cache F-Droid APKs
uses: actions/cache/save@v5
with:
path: ${{ env.apk-dir }}
key: fdroid-apks-${{ hashFiles(format('{0}/*.apk', env.apk-dir)) }}
- 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: Run device tests
run: ./gradlew virtualCheck