diff --git a/.github/workflows/Build.yaml b/.github/workflows/Build.yaml index f398269bf..a3a58ba97 100644 --- a/.github/workflows/Build.yaml +++ b/.github/workflows/Build.yaml @@ -67,11 +67,8 @@ jobs: androidTest: needs: build - runs-on: macOS-latest # enables hardware acceleration in the virtual machine + runs-on: ubuntu-latest timeout-minutes: 30 - strategy: - matrix: - api-level: [23, 26, 30] steps: - name: Checkout @@ -97,18 +94,6 @@ jobs: key: gradle-${{ hashFiles('checksum.txt') }} - name: Run instrumentation tests - uses: reactivecircus/android-emulator-runner@v2 - with: - api-level: ${{ matrix.api-level }} - arch: x86_64 - disable-animations: true - disk-size: 1500M - heap-size: 512M - script: ./gradlew connectedAndroidTest -x :benchmark:connectedBenchmarkAndroidTest - - - name: Upload test reports - if: always() - uses: actions/upload-artifact@v2 - with: - name: test-reports - path: app/build/reports/androidTests + env: + EW_API_TOKEN: ${{ secrets.EW_API_TOKEN }} + run: ./gradlew testDebugWithEmulatorWtf diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 15405e118..d7bff292c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -21,6 +21,7 @@ plugins { id("jacoco") id("dagger.hilt.android.plugin") id("nowinandroid.spotless") + id("nowinandroid.wtf.emulator") } android { diff --git a/build-logic/convention/build.gradle.kts b/build-logic/convention/build.gradle.kts index ab9e700ec..3a0e09e83 100644 --- a/build-logic/convention/build.gradle.kts +++ b/build-logic/convention/build.gradle.kts @@ -29,4 +29,5 @@ dependencies { implementation(libs.android.gradlePlugin) implementation(libs.kotlin.gradlePlugin) implementation(libs.spotless.gradlePlugin) + implementation(libs.emulator.wtf.gradlePlugin) } diff --git a/build-logic/convention/src/main/kotlin/nowinandroid.wtf.emulator.gradle.kts b/build-logic/convention/src/main/kotlin/nowinandroid.wtf.emulator.gradle.kts new file mode 100644 index 000000000..0efe4454d --- /dev/null +++ b/build-logic/convention/src/main/kotlin/nowinandroid.wtf.emulator.gradle.kts @@ -0,0 +1,27 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("wtf.emulator.gradle") +} + +emulatorwtf { + devices.set(listOf( + mapOf("model" to "Pixel2", "version" to 23), + mapOf("model" to "Pixel2", "version" to 27), + mapOf("model" to "Pixel2", "version" to 31), + )) +} diff --git a/build.gradle.kts b/build.gradle.kts index 052e34df4..81bc69c7a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,6 +22,7 @@ buildscript { dependencies { classpath(libs.android.gradlePlugin) + classpath(libs.emulator.wtf.gradlePlugin) classpath(libs.kotlin.gradlePlugin) classpath(libs.kotlin.serializationPlugin) classpath(libs.hilt.gradlePlugin) diff --git a/core-database/build.gradle.kts b/core-database/build.gradle.kts index 0461f28f2..fd9e970a5 100644 --- a/core-database/build.gradle.kts +++ b/core-database/build.gradle.kts @@ -20,6 +20,7 @@ plugins { id("dagger.hilt.android.plugin") alias(libs.plugins.ksp) id("nowinandroid.spotless") + id("nowinandroid.wtf.emulator") } android { diff --git a/feature-author/build.gradle.kts b/feature-author/build.gradle.kts index d212fe597..4c443eae5 100644 --- a/feature-author/build.gradle.kts +++ b/feature-author/build.gradle.kts @@ -20,6 +20,7 @@ plugins { kotlin("kapt") id("dagger.hilt.android.plugin") id("nowinandroid.spotless") + id("nowinandroid.wtf.emulator") } android { diff --git a/feature-foryou/build.gradle.kts b/feature-foryou/build.gradle.kts index eb8cea8f1..61a4a3309 100644 --- a/feature-foryou/build.gradle.kts +++ b/feature-foryou/build.gradle.kts @@ -20,6 +20,7 @@ plugins { kotlin("kapt") id("dagger.hilt.android.plugin") id("nowinandroid.spotless") + id("nowinandroid.wtf.emulator") } android { diff --git a/feature-interests/build.gradle.kts b/feature-interests/build.gradle.kts index 396d6c85e..6be9ed888 100644 --- a/feature-interests/build.gradle.kts +++ b/feature-interests/build.gradle.kts @@ -20,6 +20,7 @@ plugins { kotlin("kapt") id("dagger.hilt.android.plugin") id("nowinandroid.spotless") + id("nowinandroid.wtf.emulator") } android { diff --git a/feature-topic/build.gradle.kts b/feature-topic/build.gradle.kts index de2c8085b..09704b735 100644 --- a/feature-topic/build.gradle.kts +++ b/feature-topic/build.gradle.kts @@ -20,6 +20,7 @@ plugins { kotlin("kapt") id("dagger.hilt.android.plugin") id("nowinandroid.spotless") + id("nowinandroid.wtf.emulator") } android { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 03d42bbda..04960e3f2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -23,6 +23,7 @@ androidxTestExt = "1.1.2" androidxUiAutomator = "2.2.0" androidxWork = "2.7.1" coil = "2.0.0-rc01" +emulatorWtfGradlePlugin = "0.0.9" hilt = "2.41" hiltExt = "1.0.0" jacoco = "0.8.7" @@ -86,6 +87,7 @@ androidx-work-testing = { group = "androidx.work", name = "work-testing", versio coil-kt = { group = "io.coil-kt", name = "coil", version.ref = "coil"} coil-kt-compose = { group = "io.coil-kt", name = "coil-compose", version.ref = "coil"} coil-kt-svg = { group = "io.coil-kt", name = "coil-svg", version.ref = "coil"} +emulator-wtf-gradlePlugin = { group = "wtf.emulator", name = "gradle-plugin", version.ref = "emulatorWtfGradlePlugin" } hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" } hilt-ext-work = { group = "androidx.hilt", name = "hilt-work", version.ref = "hiltExt" } hilt-ext-compiler = { group = "androidx.hilt", name = "hilt-compiler", version.ref = "hiltExt" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 489ed6f8d..a46afd850 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,7 +24,7 @@ pluginManagement { } dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) repositories { // Register the AndroidX snapshot repository first so snapshots don't attempt (and fail) // to download from the non-snapshot repositories @@ -37,6 +37,11 @@ dependencyResolutionManagement { } google() mavenCentral() + maven(url = "https://maven.emulator.wtf/releases/") { + content { + includeGroup("wtf.emulator") + } + } } } rootProject.name = "nowinandroid" diff --git a/sync/build.gradle.kts b/sync/build.gradle.kts index 531032a9f..3669af9a7 100644 --- a/sync/build.gradle.kts +++ b/sync/build.gradle.kts @@ -19,6 +19,7 @@ plugins { kotlin("kapt") id("dagger.hilt.android.plugin") id("nowinandroid.spotless") + id("nowinandroid.wtf.emulator") } android {