Skip to content

Commit

Permalink
Run tests on emulator
Browse files Browse the repository at this point in the history
  • Loading branch information
erikeelde committed May 10, 2024
1 parent cc0e41d commit 7853bf1
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 14 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,45 @@ jobs:
name: Reports
path: '**/build/reports/*'
retention-days: 2


emulator-tests:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Check out java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- 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: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 30
script: ./gradlew :toggles-app:pixel2api30DebugAndroidTest

- name: "Upload reports"
uses: actions/upload-artifact@v4
if: failure()
with:
name: "Android test results"
path: '**/build/reports/*'
retention-days: 2
2 changes: 1 addition & 1 deletion build-logic/conventions/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ dependencyResolutionManagement {
}

plugins {
id("com.gradle.enterprise") version "3.16.1"
id("com.gradle.develocity") version "3.17.2"
id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
}
14 changes: 8 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[versions]
agp = "8.2.1"
agp = "8.4.0"
androidx-activity = "1.7.1"
androidx-appcompat = "1.6.1"
androidx-arch-core = "2.2.0"
androidx-collection = "1.1.0"
androidx-compose-bom = "2023.10.01"
androidx-compose-compiler = "1.5.8"
androidx-compose-bom = "2024.05.00"
androidx-compose-compiler = "1.5.13"
androidx-core = "1.10.0"
androidx-hilt = "1.0.0"
androidx-lifecycle = "2.6.1"
Expand All @@ -20,7 +20,8 @@ com-squareup-moshi = "1.15.0"
dokka = "1.9.0"
espresso-core = "3.5.1"
junit = "4.13.2"
kotlin = "1.9.22"
kotlin = "1.9.23"
orchestrator = "1.4.2"
org-jetbrains-kotlinx = "1.6.4"

[libraries]
Expand Down Expand Up @@ -80,6 +81,7 @@ androidx-navigation-navigation-common-ktx = { module = "androidx.navigation:navi
androidx-navigation-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "androidx-navigation" }
androidx-navigation-navigation-runtime = { module = "androidx.navigation:navigation-runtime", version.ref = "androidx-navigation" }
androidx-navigation-navigation-runtime-ktx = { module = "androidx.navigation:navigation-runtime-ktx", version.ref = "androidx-navigation" }
androidx-test-orchestrator = { module = "androidx.test:orchestrator", version.ref = "orchestrator" }
androidx-room-room-compiler = { module = "androidx.room:room-compiler", version.ref = "androidx-room" }
androidx-room-room-ktx = { module = "androidx.room:room-ktx", version.ref = "androidx-room" }
androidx-room-room-runtime = { module = "androidx.room:room-runtime", version.ref = "androidx-room" }
Expand All @@ -99,7 +101,7 @@ androidx-vectordrawable-vectordrawable-animated = { module = "androidx.vectordra
androidx-versionedparcelable = "androidx.versionedparcelable:versionedparcelable:1.1.1"
androidx-viewpager = "androidx.viewpager:viewpager:1.0.0"
app-cash-licensee-licensee-gradle-plugin = "app.cash.licensee:licensee-gradle-plugin:1.8.0"
com-android-tools-build-gradle = "com.android.tools.build:gradle:8.2.1"
com-android-tools-build-gradle = "com.android.tools.build:gradle:8.4.0"
com-google-code-findbugs-jsr305 = "com.google.code.findbugs:jsr305:3.0.2"
com-google-dagger = { module = "com.google.dagger:dagger", version.ref = "com-google-dagger" }
com-google-dagger-dagger-compiler = { module = "com.google.dagger:dagger-compiler", version.ref = "com-google-dagger" }
Expand Down Expand Up @@ -140,7 +142,7 @@ com-autonomousapps-dependency-analysis = "com.autonomousapps.dependency-analysis
com-github-ben-manes-versions = "com.github.ben-manes.versions:0.50.0"
com-github-triplet-play = "com.github.triplet.play:3.8.4"
com-google-dagger-hilt-android = { id = "com.google.dagger.hilt.android", version.ref = "com-google-dagger" }
com-google-devtools-ksp = "com.google.devtools.ksp:1.9.22-1.0.16"
com-google-devtools-ksp = "com.google.devtools.ksp:1.9.23-1.0.20"
com-google-firebase-crashlytics = "com.google.firebase.crashlytics:2.9.8"
com-google-gms-google-services = "com.google.gms.google-services:4.3.15"
com-vanniktech-maven-publish = "com.vanniktech.maven.publish:0.27.0"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pluginManagement {
}

plugins {
id("com.gradle.enterprise") version "3.16.1"
id("com.gradle.develocity") version "3.17.2"
id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
}

Expand Down
21 changes: 21 additions & 0 deletions toggles-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,26 @@ android {
versionNameSuffix = " debug"
}
}
testOptions {
animationsDisabled = true
execution = "ANDROIDX_TEST_ORCHESTRATOR"
unitTests {
isReturnDefaultValues = true
isIncludeAndroidResources = true
}
managedDevices {
devices {
maybeCreate<com.android.build.api.dsl.ManagedVirtualDevice>("pixel2api30").apply {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// Use only API levels 30 and higher.
apiLevel = 30
// To include Google services, use "google".
systemImageSource = "aosp"
}
}
}
}
}

dependencies {
Expand Down Expand Up @@ -167,4 +187,5 @@ dependencies {
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.compose.ui.ui.test.junit4)
androidTestUtil(libs.androidx.test.orchestrator)
}
2 changes: 1 addition & 1 deletion toggles-core/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pluginManagement {
}

plugins {
id("com.gradle.enterprise") version "3.16.1"
id("com.gradle.develocity") version "3.17.2"
id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
}

Expand Down
2 changes: 1 addition & 1 deletion toggles-flow-noop/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pluginManagement {
}

plugins {
id("com.gradle.enterprise") version "3.16.1"
id("com.gradle.develocity") version "3.17.2"
id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
}

Expand Down
2 changes: 1 addition & 1 deletion toggles-flow/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pluginManagement {
}

plugins {
id("com.gradle.enterprise") version "3.16.1"
id("com.gradle.develocity") version "3.17.2"
id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
}

Expand Down
2 changes: 1 addition & 1 deletion toggles-prefs-noop/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pluginManagement {
}

plugins {
id("com.gradle.enterprise") version "3.16.1"
id("com.gradle.develocity") version "3.17.2"
id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
}

Expand Down
2 changes: 1 addition & 1 deletion toggles-prefs/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pluginManagement {
}

plugins {
id("com.gradle.enterprise") version "3.16.1"
id("com.gradle.develocity") version "3.17.2"
id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
}

Expand Down

0 comments on commit 7853bf1

Please sign in to comment.