Skip to content

Merge pull request #454 from Futsch1/bugfixes #233

Merge pull request #454 from Futsch1/bugfixes

Merge pull request #454 from Futsch1/bugfixes #233

Workflow file for this run

name: Test
on:
workflow_dispatch:
push:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
env:
target_api_level: 34
profile: medium_phone
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up JDK 17
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- 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-${{ env.target_api_level }}-${{ env.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: ${{ env.target_api_level }}
arch: x86_64
target: google_apis
profile: ${{ env.profile }}
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 Android tests, unit tests and monkey test
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0
with:
api-level: ${{ env.target_api_level }}
profile: ${{ env.profile }}
arch: x86_64
target: google_apis
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
adb uninstall com.futsch1.medtimer || true
EXIT_CODE=0 && ./gradlew JacocoDebugCodeCoverage || EXIT_CODE=$? && (adb pull /sdcard/googletest/test_outputfiles app/build/outputs/androidTest-results/ || true) && exit $EXIT_CODE
adb install -g app/build/outputs/apk/debug/MedTimer-debug.apk
adb shell monkey -p com.futsch1.medtimer -v 2000
cores: 4
- name: Run fuzzing tests
run: ./gradlew testDebug -Dfuzzing=true
- name: Android lint
run: ./gradlew lint
- name: SonarQube
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
if: ${{ env.SONAR_TOKEN != '' }}
run: ./gradlew sonar
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
if: always()
with:
name: TestReports
path: |
app/build/reports/jacoco/JacocoDebugCodeCoverage/html
app/build/reports/tests/testDebugUnitTest
app/build/reports/androidTest/connected/debug
app/build/reports/lint-results-debug.html
app/build/outputs/androidTest-results