Merge pull request #75 from fknives/issue#74-emulator-on-ci
Issue#74 Attempt to integrate testing on emulator
This commit is contained in:
commit
f9a24b164a
2 changed files with 60 additions and 2 deletions
53
.github/workflows/pull-request-jobs.yml
vendored
53
.github/workflows/pull-request-jobs.yml
vendored
|
|
@ -31,7 +31,7 @@ jobs:
|
|||
if: always()
|
||||
with:
|
||||
name: Detekt Results
|
||||
path: build/reports/detekt.html
|
||||
path: ./build/reports/detekt/detekt.html
|
||||
retention-days: 1
|
||||
- name: Run ktlint
|
||||
run: ./gradlew ktlintCheck
|
||||
|
|
@ -73,3 +73,54 @@ jobs:
|
|||
name: JVM Test Results
|
||||
path: ./**/build/reports/tests/**/index.html
|
||||
retention-days: 1
|
||||
|
||||
run-tests-on-emulator:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
api-level: [ 21, 30 ]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '11'
|
||||
- name: Gradle cache
|
||||
uses: gradle/gradle-build-action@v2
|
||||
- name: AVD cache
|
||||
uses: actions/cache@v3
|
||||
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:
|
||||
arch: 'x86_64'
|
||||
api-level: ${{ matrix.api-level }}
|
||||
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 Tests
|
||||
uses: reactivecircus/android-emulator-runner@v2
|
||||
with:
|
||||
arch: 'x86_64'
|
||||
api-level: ${{ 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
|
||||
script: ./gradlew connectedDebugAndroidTest
|
||||
- name: Upload Test Results
|
||||
uses: actions/upload-artifact@v2
|
||||
if: always()
|
||||
with:
|
||||
name: Emulator-Test-Results-${{ matrix.api-level }}
|
||||
path: ./**/build/reports/androidTests/**/*.html
|
||||
retention-days: 1
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package org.fnives.test.showcase.compose.screen.splash
|
||||
|
||||
import android.os.Build.VERSION
|
||||
import android.os.Build.VERSION_CODES
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
|
|
@ -16,8 +18,13 @@ import org.fnives.test.showcase.R
|
|||
@Composable
|
||||
fun SplashScreen() {
|
||||
Box(Modifier.fillMaxSize().background(colorResource(R.color.purple_700)), contentAlignment = Alignment.Center) {
|
||||
val resourceId = if (VERSION.SDK_INT >= VERSION_CODES.N) {
|
||||
R.drawable.ic_launcher_foreground
|
||||
} else {
|
||||
R.mipmap.ic_launcher_round
|
||||
}
|
||||
Image(
|
||||
painter = painterResource(R.mipmap.ic_launcher_round),
|
||||
painter = painterResource(resourceId),
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(120.dp)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue