Skip to content

Add caching for emulator? #92

Add caching for emulator?

Add caching for emulator? #92

Workflow file for this run

name: Java CI with Gradle
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
DATABASE_URL: sqlite://ci.db?mode=rwc
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend
steps:
- 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
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- uses: Swatinem/rust-cache@v2
- name: Run backend for testing
run: |
cargo install sqlx-cli --no-default-features --features sqlite
cargo sqlx db create
cargo sqlx migrate run
cargo build
cargo run &
working-directory: backend
- name: Build with Gradle
run: ./gradlew build -x test
- name: Test (local)
run: ./gradlew test -i
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd
- 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: 29
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: Test (emulator)
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
working-directory: ./frontend
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 connectedCheck
- name: Report
uses: FlickerSoul/android-test-report-actions@v1.2
with:
working-directory: "./frontend"
show-skipped: "true"
if: ${{ always() }}
- name: Lint
run: |
./gradlew lint
./gradlew ktlintCheck