Run watchdog tests #18
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: Run watchdog tests | |
on: | |
schedule: | |
- cron: '0 */4 * * *' | |
workflow_dispatch: | |
inputs: | |
JDK_VERSION: | |
description: The JDK version to use | |
type: number | |
default: 11 | |
env: | |
JDK_VERSION: ${{ inputs.JDK_VERSION || '11' }} | |
API_LEVEL: 26 | |
jobs: | |
watchdog-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
branch: [ "master", "release" ] | |
steps: | |
- name: Checkout the latest code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.branch }} | |
# https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ | |
- 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: Setup cgeo preferences and keystore | |
uses: ./.github/actions/cgeo-preferences | |
with: | |
KEY_STORE: ${{ secrets.KEY_STORE }} | |
KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} | |
KEY_ALIAS_PASSWORD: ${{ secrets.KEY_ALIAS_PASSWORD }} | |
MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }} | |
MAPS_API_KEY_MARKET: ${{ secrets.MAPS_API_KEY_MARKET }} | |
MAPS_API2_KEY: ${{ secrets.MAPS_API2_KEY }} | |
OCDE_OKAPI_CONSUMER_KEY: ${{ secrets.OCDE_OKAPI_CONSUMER_KEY }} | |
OCDE_OKAPI_CONSUMER_SECRET: ${{ secrets.OCDE_OKAPI_CONSUMER_SECRET }} | |
OCPL_OKAPI_CONSUMER_KEY: ${{ secrets.OCPL_OKAPI_CONSUMER_KEY }} | |
OCPL_OKAPI_CONSUMER_SECRET: ${{ secrets.OCPL_OKAPI_CONSUMER_SECRET }} | |
OCUS_OKAPI_CONSUMER_KEY: ${{ secrets.OCUS_OKAPI_CONSUMER_KEY }} | |
OCUS_OKAPI_CONSUMER_SECRET: ${{ secrets.OCUS_OKAPI_CONSUMER_SECRET }} | |
OCNL_OKAPI_CONSUMER_KEY: ${{ secrets.OCNL_OKAPI_CONSUMER_KEY }} | |
OCNL_OKAPI_CONSUMER_SECRET: ${{ secrets.OCNL_OKAPI_CONSUMER_SECRET }} | |
OCRO_OKAPI_CONSUMER_KEY: ${{ secrets.OCRO_OKAPI_CONSUMER_KEY }} | |
OCRO_OKAPI_CONSUMER_SECRET: ${{ secrets.OCRO_OKAPI_CONSUMER_SECRET }} | |
OCUK_OKAPI_CONSUMER_KEY: ${{ secrets.OCUK_OKAPI_CONSUMER_KEY }} | |
OCUK_OKAPI_CONSUMER_SECRET: ${{ secrets.OCUK_OKAPI_CONSUMER_SECRET }} | |
SU_CONSUMER_KEY: ${{ secrets.SU_CONSUMER_KEY }} | |
SU_CONSUMER_SECRET: ${{ secrets.SU_CONSUMER_SECRET }} | |
THUNDERFOREST_API_KEY: ${{ secrets.THUNDERFOREST_API_KEY }} | |
ALC_CONSUMER_KEY: ${{ secrets.ALC_CONSUMER_KEY }} | |
PREF_COOKIESTORE: ${{ secrets.PREF_COOKIESTORE }} | |
PREF_USERNAME: ${{ secrets.PREF_USERNAME }} | |
PREF_PASSWORD: ${{ secrets.PREF_PASSWORD }} | |
- name: Set up JDK ${{ env.JDK_VERSION }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ env.JDK_VERSION }} | |
distribution: temurin | |
- name: Gradle cache | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/androidci' }} | |
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
- name: AVD cache | |
uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ env.API_LEVEL }} | |
- 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: ${{ env.API_LEVEL }} | |
target: google_apis | |
arch: x86_64 | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
script: echo "Generated AVD snapshot for caching." | |
- name: Run Unit Tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
env: | |
# Define BUILD_NUMBER environment variable else the change from commit | |
# https://github.com/cgeo/cgeo/commit/cfa797e3a48cbd581a31f470703ee15ddb191f49 | |
# prevent us to be recognized as a runner, which lead to appID being suffixed | |
# by ".developer" thus leading to failure installing the cgeo prefrences | |
BUILD_NUMBER: ${{ github.run_number }} | |
with: | |
api-level: ${{ env.API_LEVEL }} | |
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 | |
disable-animations: true | |
script: | | |
./gradlew main:connectedBasicDebugAndroidTest --no-daemon --continue -Pandroid.testInstrumentationRunnerArguments.class=cgeo.watchdog.WatchdogTest | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v4 | |
if: always() # always run even if the previous step fails | |
with: | |
report_paths: '**/build/test-results/**/*.xml' |