diff --git a/.github/actions/setup-host/action.yml b/.github/actions/setup-host/action.yml index 7959750..3263947 100644 --- a/.github/actions/setup-host/action.yml +++ b/.github/actions/setup-host/action.yml @@ -18,9 +18,17 @@ runs: uses: gradle/actions/setup-gradle@v3 with: cache-encryption-key: ${{ inputs.gradle-encryption-key }} + - name: Add Android SDK to PATH + shell: bash + run: | + echo "$ANDROID_HOME" >> "$GITHUB_ENV" + echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> "$GITHUB_PATH" - name: Accept Android licences shell: bash - run: (yes || true) | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses + run: yes | sdkmanager --licenses || true + - name: Install Android Emulator image + shell: bash + run: sdkmanager 'system-images;android-34;google_apis;x86_64' - # 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 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1c2cdf7..6a16a0c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,7 +16,7 @@ permissions: jobs: build: name: Build - runs-on: macos-latest # to use Android emulator + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 @@ -27,7 +27,7 @@ jobs: with: gradle-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - name: Test & Build - run: ./gradlew -s build + run: ./gradlew -si :demo-project:ui-tests:emulatorSetup - name: Publish Test Report uses: gmazzo/publish-report-annotations@v1 if: always() diff --git a/demo-project/ui-tests/build.gradle.kts b/demo-project/ui-tests/build.gradle.kts index 678d178..7bc6d8f 100644 --- a/demo-project/ui-tests/build.gradle.kts +++ b/demo-project/ui-tests/build.gradle.kts @@ -25,15 +25,15 @@ android { } } -val pixel2 by android.testOptions.managedDevices.devices.creating(ManagedVirtualDevice::class) { +val emulator by android.testOptions.managedDevices.devices.creating(ManagedVirtualDevice::class) { device = "Pixel 6" - apiLevel = 30 - systemImageSource = "aosp-atd" + apiLevel = libs.versions.android.compileSDK.get().toInt() + systemImageSource = "google_apis" } baselineProfile { useConnectedDevices = false - managedDevices += pixel2.name + managedDevices += emulator.name } dependencies {