From 52bb51ef5dbb2c0aa7d9e7eaf10aaf881eafd8ab Mon Sep 17 00:00:00 2001 From: Devin Bileck <603793+devinbileck@users.noreply.github.com> Date: Tue, 30 Jan 2024 23:47:55 -0800 Subject: [PATCH] chore: Try updating CI workflow for instrumentation tests --- .github/workflows/ci.yaml | 65 ++++++++++----------------------------- 1 file changed, 17 insertions(+), 48 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 83dfdbc..2435a61 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -116,34 +116,12 @@ jobs: timeout-minutes: 30 needs: unit-tests strategy: - fail-fast: true + fail-fast: false matrix: api-level: [ 26, 27, 28, 29, 30, 31, 32, 33, 34 ] steps: - name: Checkout the code - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - - name: Set up JDK 17 - uses: actions/setup-java@a18c333f3f14249953dab3e186e5e21bf3390f1d - with: - java-version: '17' - distribution: 'corretto' - cache: gradle - - - name: Clear gradle cache - run: | - mv ~/.gradle ~/.invalid || true - - - name: Cache dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ env.CACHE_VERSION }}-${{ hashFiles('**/**.gradle.kts', '**/gradle/wrapper/gradle-wrapper.properties', '**/libs.versions.toml') }} - - - name: Check Gradle wrapper - uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b + uses: actions/checkout@v4 - name: Enable KVM run: | @@ -151,48 +129,39 @@ jobs: sudo udevadm control --reload-rules sudo udevadm trigger --name-match=kvm - # API 30+ emulators only have x86_64 system images - - name: Get AVD info - uses: ./.github/actions/get-avd-info - id: avd-info - with: - api-level: ${{ matrix.api-level }} + - name: Check Gradle wrapper + uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b - # Retrieve the cached emulator snapshot - - name: Retrieve cached emulator snapshot - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + - name: Gradle cache + uses: gradle/actions/setup-gradle@v3 + + - name: AVD cache + uses: actions/cache@v4 id: avd-cache with: path: | ~/.android/avd/* ~/.android/adb* - key: ${{ runner.os }}-avd-${{ env.CACHE_VERSION }}-${{ steps.avd-info.outputs.arch }}-${{ steps.avd-info.outputs.target }}-${{ matrix.api-level }} + key: avd-${{ matrix.api-level }} - # Create a new emulator snapshot if it isn't present in the cache - - name: Create AVD snapshot + - name: Create AVD and generate snapshot for caching if: steps.avd-cache.outputs.cache-hit != 'true' - uses: reactivecircus/android-emulator-runner@d7b53ddc6e44254e1f4cf4a6ad67345837027a66 + uses: reactivecircus/android-emulator-runner@v2 with: api-level: ${{ matrix.api-level }} - arch: ${{ steps.avd-info.outputs.arch }} - target: ${{ steps.avd-info.outputs.target }} - disable-animations: false force-avd-creation: false - ram-size: 4096M emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - script: echo "Generated AVD snapshot" + disable-animations: false + script: echo "Generated AVD snapshot for caching." - name: Run instrumentation tests - uses: reactivecircus/android-emulator-runner@d7b53ddc6e44254e1f4cf4a6ad67345837027a66 + uses: reactivecircus/android-emulator-runner@v2 with: api-level: ${{ matrix.api-level }} - arch: ${{ steps.avd-info.outputs.arch }} - target: ${{ steps.avd-info.outputs.target }} - disable-animations: true force-avd-creation: false - ram-size: 4096M emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - script: mv .github/debug.keystore ~/.android; ./gradlew connectedCheck + disable-animations: true + script: ./gradlew connectedCheck - name: Upload reports uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb