Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI emulator run #27

Merged
merged 6 commits into from
Feb 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change to Gradle managed devices
  • Loading branch information
wmontwe committed Feb 19, 2023
commit 1df1bb38a34779103588a3e64fe1ac631954b2ec
24 changes: 7 additions & 17 deletions .github/workflows/ci-pull-request-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,17 @@ jobs:
- name: Setup Android SDK
uses: android-actions/setup-android@v2

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

- name: Version
run: ./gradlew --no-daemon --stacktrace versionInfo
run: ./gradlew --stacktrace versionInfo

- name: Build
run: ./gradlew --no-daemon --stacktrace build
run: ./gradlew --stacktrace build

- name: Run Android Device Tests
uses: reactivecircus/android-emulator-runner@v2
env:
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 120
with:
api-level: ${{ matrix.api-level }}
target: google_apis
arch: x86
profile: Nexus 5
avd-name: blueprint-${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
disk-size: 2048M
script: ./gradlew --no-daemon --stacktrace connectedCheck
- name: Run Android instrumented tests
run: ./gradlew androidGroupDebugAndroidTest

- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
Expand Down
21 changes: 20 additions & 1 deletion app-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import com.android.build.api.dsl.ManagedVirtualDevice
import eu.bitfunk.gradle.plugin.tool.versioning.version
import eu.bitfunk.gradle.plugin.tool.versioning.versionCode

Expand Down Expand Up @@ -54,7 +55,7 @@ android {

packagingOptions {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
excludes += "/META-INF/{AL2.0,LGPL2.1,*.md}"
}
}

Expand All @@ -64,6 +65,23 @@ android {

baseline = file("lint-baseline.xml")
}

testOptions {
managedDevices {
devices {
maybeCreate<ManagedVirtualDevice>("Pixel_2_API_30").apply {
device = "Pixel 2"
apiLevel = 30
systemImageSource = "google-atd"
}
}
groups {
maybeCreate("android").apply {
targetDevices.add(devices["Pixel_2_API_30"])
}
}
}
}
}

dependencies {
Expand All @@ -74,4 +92,5 @@ dependencies {
debugImplementation(libs.bundles.app.android.compose.debug)
testImplementation(libs.bundles.app.android.test)
androidTestImplementation(libs.bundles.app.android.androidTest)
androidTestImplementation(libs.bundles.app.android.androidTest.compose)
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ class ExampleInstrumentedTest {
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.myapplication", appContext.packageName)
assertEquals("eu.bitfunk.blueprint.mobile.android.app", appContext.packageName)
}
}