diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fcc6789..129a668 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3c6c9ea..dfbee4b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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 diff --git a/.github/workflows/setup-host/action.yml b/.github/workflows/setup-host/action.yml index 3ab3b2a..ffd86e2 100644 --- a/.github/workflows/setup-host/action.yml +++ b/.github/workflows/setup-host/action.yml @@ -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 diff --git a/demo-project/ui-tests/build.gradle.kts b/demo-project/ui-tests/build.gradle.kts index 0f290e2..169023c 100644 --- a/demo-project/ui-tests/build.gradle.kts +++ b/demo-project/ui-tests/build.gradle.kts @@ -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) + } +}