mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
ci: Cache AVD snapshots to speed up Android tests (#4030)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
aff0a49756
commit
17825d3b98
2 changed files with 33 additions and 3 deletions
23
.github/workflows/reusable-android-test.yml
vendored
23
.github/workflows/reusable-android-test.yml
vendored
|
|
@ -55,6 +55,26 @@ jobs:
|
|||
build-scan-terms-of-use-agree: 'yes'
|
||||
add-job-summary: always
|
||||
|
||||
- name: AVD cache
|
||||
uses: actions/cache@v4
|
||||
id: avd-cache
|
||||
with:
|
||||
path: |
|
||||
~/.android/avd/*
|
||||
~/.android/adb*
|
||||
key: avd-${{ matrix.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: ${{ matrix.api-level }}
|
||||
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 Android Instrumented Tests
|
||||
uses: reactivecircus/android-emulator-runner@v2
|
||||
env:
|
||||
|
|
@ -63,9 +83,10 @@ jobs:
|
|||
api-level: ${{ matrix.api-level }}
|
||||
arch: x86_64
|
||||
force-avd-creation: false
|
||||
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -no-metrics -camera-back none
|
||||
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
||||
disable-animations: true
|
||||
script: ./gradlew :app:connectedFdroidDebugAndroidTest :app:connectedGoogleDebugAndroidTest --configuration-cache --scan && ( killall -INT crashpad_handler || true )
|
||||
|
||||
- name: Upload test results to Codecov
|
||||
if: ${{ !cancelled() }}
|
||||
uses: codecov/test-results-action@v1
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
|
|||
import org.jetbrains.kotlin.gradle.dsl.KotlinBaseExtension
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import java.io.FileInputStream
|
||||
import java.util.Properties
|
||||
|
||||
/**
|
||||
* Configure base Kotlin with Android options
|
||||
|
|
@ -37,11 +39,18 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|||
internal fun Project.configureKotlinAndroid(
|
||||
commonExtension: CommonExtension<*, *, *, *, *, *>,
|
||||
) {
|
||||
val configPropertiesFile = rootProject.file("config.properties")
|
||||
val configProperties = Properties()
|
||||
|
||||
if (configPropertiesFile.exists()) {
|
||||
FileInputStream(configPropertiesFile).use { configProperties.load(it) }
|
||||
}
|
||||
|
||||
commonExtension.apply {
|
||||
compileSdk = 36
|
||||
compileSdk = configProperties.get("COMPILE_SDK").toString().toInt()
|
||||
|
||||
defaultConfig {
|
||||
minSdk = 26
|
||||
minSdk = configProperties.get("MIN_SDK").toString().toInt()
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue