diff --git a/.github/workflows/merge-queue.yml b/.github/workflows/merge-queue.yml index f06e7e1afb..b869474bf1 100644 --- a/.github/workflows/merge-queue.yml +++ b/.github/workflows/merge-queue.yml @@ -24,7 +24,7 @@ jobs: if: github.repository == 'meshtastic/Meshtastic-Android' uses: ./.github/workflows/reusable-android-test.yml with: - api_levels: '[26, 35]' # Run on both API 26 and 35 for merge queue + api_levels: '[32, 35]' # Run on both API 32 and 35 for merge queue upload_artifacts: false secrets: GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/reusable-android-test.yml b/.github/workflows/reusable-android-test.yml index 472acff68a..c1002332c3 100644 --- a/.github/workflows/reusable-android-test.yml +++ b/.github/workflows/reusable-android-test.yml @@ -9,10 +9,10 @@ on: type: boolean default: true api_levels: - description: 'JSON array string of API levels to run tests on (e.g., `[35]` or `[26, 35]`)' + description: 'JSON array string of API levels to run tests on (e.g., `[35]` or `[32, 35]`)' required: false type: string - default: '[26, 35]' # Default to running both if not specified by caller + default: '[32, 35]' # Default to running both if not specified by caller secrets: GRADLE_ENCRYPTION_KEY: required: false @@ -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 diff --git a/build-logic/convention/src/main/kotlin/com/geeksville/mesh/buildlogic/KotlinAndroid.kt b/build-logic/convention/src/main/kotlin/com/geeksville/mesh/buildlogic/KotlinAndroid.kt index aa32fd18b5..a226fcaf4a 100644 --- a/build-logic/convention/src/main/kotlin/com/geeksville/mesh/buildlogic/KotlinAndroid.kt +++ b/build-logic/convention/src/main/kotlin/com/geeksville/mesh/buildlogic/KotlinAndroid.kt @@ -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 { diff --git a/config.properties b/config.properties index 68f4fa854c..77608b923d 100644 --- a/config.properties +++ b/config.properties @@ -20,7 +20,7 @@ VERSION_CODE_OFFSET=29314197 # Application and SDK versions APPLICATION_ID=com.geeksville.mesh -MIN_SDK=26 +MIN_SDK=32 TARGET_SDK=36 COMPILE_SDK=36