From 9d3c275ca8eb4b093fdaef07a1d2773185074e58 Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Wed, 4 Sep 2024 15:06:23 +0530 Subject: [PATCH 1/3] Re-enabled the emulator caching in CI. --- .github/workflows/ci.yml | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0d2b40a7..cb6750c61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,33 @@ jobs: sudo udevadm control --reload-rules sudo udevadm trigger --name-match=kvm + - name: AVD cache + uses: actions/cache@v4 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-${{ matrix.api-level }} + + - name: Create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ matrix.api-level }} + target: default + arch: x86_64 + profile: pixel_2 + ram-size: 4096M + force-avd-creation: false + sdcard-path-or-size: 2048M + cores: 4 + disable-animations: false + heap-size: 512M + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + channel: canary + script: echo "Generated AVD snapshot for caching." + - name: create instrumentation coverage uses: reactivecircus/android-emulator-runner@v2 env: @@ -54,8 +81,10 @@ jobs: profile: pixel_2 ram-size: 4096M cores: 4 + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none sdcard-path-or-size: 2048M disable-animations: true + force-avd-creation: false heap-size: 512M emulator-boot-timeout: 1200 script: bash contrib/instrumentation.sh @@ -71,8 +100,10 @@ jobs: profile: pixel_2 ram-size: 3072M cores: 4 - sdcard-path-or-size: 1024M + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true + force-avd-creation: false + sdcard-path-or-size: 1024M emulator-boot-timeout: 1200 heap-size: 512M script: bash contrib/instrumentation-customapps.sh From 95ade4b28c598f5e2dac479fd1e2f2949e5b1d16 Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Wed, 4 Sep 2024 16:19:44 +0530 Subject: [PATCH 2/3] Configured the emulator to use 3GB of RAM and a 1024MB SD card instead of 4GB of RAM and a 2048MB SD card to reduce resource usage on CI. * Since the emulator works well with 3GB of RAM and a 1024MB SD card on CI for running test cases for custom apps, it is better to use this configuration for the app's test cases as well. --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb6750c61..aaad3ce4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,9 +60,9 @@ jobs: target: default arch: x86_64 profile: pixel_2 - ram-size: 4096M + ram-size: 3072M force-avd-creation: false - sdcard-path-or-size: 2048M + sdcard-path-or-size: 1024M cores: 4 disable-animations: false heap-size: 512M @@ -79,10 +79,10 @@ jobs: target: default arch: x86_64 profile: pixel_2 - ram-size: 4096M + ram-size: 3072M cores: 4 emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - sdcard-path-or-size: 2048M + sdcard-path-or-size: 1024M disable-animations: true force-avd-creation: false heap-size: 512M From 16cbe2a1e0a61595a19803ebc8211ffb9370f1c0 Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Wed, 4 Sep 2024 16:55:12 +0530 Subject: [PATCH 3/3] Try creating the codecov report on Api level 30 since some test cases are running on this api level like testing the WifiHotspot, ShowingPlayStoreRestriction in HelpFragment, etc. --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aaad3ce4b..6cfe758ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,18 +117,18 @@ jobs: path: screencap.png - name: create unit coverage - if: ${{ matrix.api-level==25 }} + if: ${{ matrix.api-level==30 }} run: ./gradlew testDebugUnitTest testCustomexampleDebugUnitTest - name: Upload coverage to Codecov - if: ${{ matrix.api-level==25 }} + if: ${{ matrix.api-level==30 }} uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} - name: Upload Coverage to GH-Actions uses: actions/upload-artifact@v3 - if: ${{ matrix.api-level==25 }} + if: ${{ matrix.api-level==30 }} with: name: Tests Coverage Report path: |