From 41208f1567adf8384d50d26b2ebd3ef808973815 Mon Sep 17 00:00:00 2001 From: Guillermo Mazzola Date: Mon, 13 May 2024 17:01:04 +0200 Subject: [PATCH] Fixed emulator setup --- .github/actions/setup-host/action.yml | 7 ++++++- .github/workflows/build.yaml | 4 ++-- demo-project/ui-tests/build.gradle.kts | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/actions/setup-host/action.yml b/.github/actions/setup-host/action.yml index 7959750..dc5e2dc 100644 --- a/.github/actions/setup-host/action.yml +++ b/.github/actions/setup-host/action.yml @@ -18,9 +18,14 @@ 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=$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 - # 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..25962ef 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) { - device = "Pixel 6" +val emulator by android.testOptions.managedDevices.devices.creating(ManagedVirtualDevice::class) { + device = "Pixel 2" apiLevel = 30 systemImageSource = "aosp-atd" } baselineProfile { useConnectedDevices = false - managedDevices += pixel2.name + managedDevices += emulator.name } dependencies {