Merge pull request #453 from weblate/weblate-medtimer-medtimer-app #156
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Compatibility test | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: [ main ] | |
permissions: | |
contents: read | |
jobs: | |
androidTest: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
api-level: [ 28, 34 ] | |
profile: [ medium_phone, medium_tablet ] | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2 | |
- 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: AVD cache | |
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }}-${{ matrix.profile }} | |
- name: Create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 | |
with: | |
api-level: ${{ matrix.api-level }} | |
profile: ${{ matrix.profile }} | |
target: google_apis | |
arch: x86_64 | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-metrics | |
disable-animations: true | |
script: echo "Generated AVD snapshot for caching." | |
- name: Run device tests | |
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 | |
with: | |
api-level: ${{ matrix.api-level }} | |
profile: ${{ matrix.profile }} | |
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 -no-metrics | |
disable-animations: true | |
script: | | |
adb shell settings put global auto_time 0 | |
adb shell su 0 date 01012100 | |
./gradlew packageDebug | |
adb shell input keyevent 3 | |
adb shell settings put secure long_press_timeout 1500 | |
EXIT_CODE=0 && ./gradlew connectedCheck || EXIT_CODE=$? && (adb pull /sdcard/googletest/test_outputfiles app/build/outputs/androidTest-results/ || true) && exit $EXIT_CODE | |
cores: 4 | |
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
if: always() | |
with: | |
name: Test reports ${{ matrix.profile }} ${{ matrix.api-level }} | |
path: | | |
app/build/reports/androidTest/connected/debug | |
app/build/outputs/androidTest-results |