Skip to content

Commit

Permalink
Add emulator tests run on Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sjudd committed Aug 21, 2023
1 parent 2ae4eff commit 9bfbf25
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 1 deletion.
66 changes: 66 additions & 0 deletions .github/workflows/instrumentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Instrumentation Tests

on:
push:
pull_request:

jobs:
test:
runs-on: macos-latest
strategy:
matrix:
include:
- api-level: 22
arch: x86
target: default
- api-level: 23
arch: x86
target: default
- api-level: 31
arch: x86_64
target: google_apis
steps:
- name: checkout
uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
- 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 }}-${{ matrix.arch }}-${{ matrix.target }}

- 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: ${{ matrix.arch }}
target: ${{ matrix.target }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
ram-size: 4096M
emulator-boot-timeout: 12000
script: echo "Generated AVD snapshot for caching."

- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: ${{ matrix.arch }}
target: ${{ matrix.target }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
ram-size: 4096M
emulator-boot-timeout: 12000
script: ./gradlew :instrumentation:connectedCheck :integration:compose:connectedCheck
3 changes: 3 additions & 0 deletions instrumentation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ dependencies {
// Not totally clear why this is required, but it seems to be missing when tests are run on
// 4.1.2 and 4.2.0 emulators.
androidTestImplementation libs.findbugs.jsr305

coreLibraryDesugaring libs.android.tools.desugar
}

android {
Expand All @@ -45,6 +47,7 @@ android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
coreLibraryDesugaringEnabled true
}

buildTypes {
Expand Down
8 changes: 7 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@
"allowedVersions": "<1.6.0"
},
{
"matchPackageNames": ["androidx.appcompat:appcompat"],
"matchPackageNames": [
"androidx.appcompat:appcompat"
],
"allowedVersions": "<1.4.0"
},
{
"matchPackageNames": ["com.android.tools:desugar_jdk_libs"],
"matchPackageNames": ["!/1\.2\.3/"]

This comment has been minimized.

Copy link
@TWiStErRob

TWiStErRob Aug 22, 2023

Collaborator

@sjudd Did you mean allowedVersions?

}
]
}
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ dependencyResolutionManagement {
library('autoservice', 'com.google.auto.service:auto-service:1.0-rc3')
library('autoservice.annotations', 'com.google.auto.service:auto-service-annotations:1.0.1')
library('android-gradle', 'com.android.tools.build:gradle:7.3.0')
// 1.2.3 seems broken: https://issuetracker.google.com/issues/290507059
library('android-tools-desugar', 'com.android.tools:desugar_jdk_libs:1.2.2')
library('androidx-cardview', 'androidx.cardview:cardview:1.0.0')
library('androidx-core', 'androidx.core:core:1.6.0')
// 1.6.0 seems to introduce:
Expand Down

0 comments on commit 9bfbf25

Please sign in to comment.