Skip to content

Commit

Permalink
Added Android SDK setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzo committed Oct 21, 2023
1 parent b2002e7 commit 1b5087e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions:
jobs:
build:
name: Build
runs-on: ubuntu-latest
runs-on: macos-latest # to use Android emulator
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
release:
name: Release
needs: build
runs-on: ubuntu-latest
runs-on: macos-latest # to use Android emulator
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/setup-host/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,15 @@ runs:
java-version: '17'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup `ANDROID_HOME` environment variable
shell: bash
run: echo ANDROID_HOME=~/android/sdk >> $GITHUB_ENV
- name: Cache Android SDK
uses: actions/cache@v3
with:
key: ${{ runner.os }}/${{ runner.arch }}-android-sdk
path: ${{ env.ANDROID_HOME }}
- # https://developer.android.com/studio/test/gradle-managed-devices#create_a_gradle_managed_device
name: Set `swiftshader_indirect` on Android Emulators (required by GHA)
shell: bash
run: echo "android.testoptions.manageddevices.emulator.gpu=swiftshader_indirect" >> ~/.gradle/gradle.properties
12 changes: 12 additions & 0 deletions demo-project/ui-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,15 @@ dependencies {
implementation(libs.androidx.test.junit)
implementation(libs.androidx.test.espresso)
}

val acceptAndroidLicences by tasks.registering(Exec::class) {
val androidHome = androidComponents.sdkComponents.sdkDirectory.get().asFile.absolutePath

commandLine("bash", "-c", "yes | $androidHome/cmdline-tools/latest/bin/sdkmanager --licenses")
}

afterEvaluate {
tasks.named("${pixel2.name}Setup") {
dependsOn(acceptAndroidLicences)
}
}

0 comments on commit 1b5087e

Please sign in to comment.