diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index 47d307ad4e..244bcf2d06 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -43,17 +43,36 @@ jobs: with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - - name: Setup KVM - shell: bash + - name: Enable KVM run: | - # check if virtualization is supported... - sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok - # allow access to KVM to run the emulator - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ - | sudo tee /etc/udev/rules.d/99-kvm4all.rules + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules 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-api-30-x86_64-aosp_atd + + - name: Create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # pin@v2 + with: + api-level: 30 + target: aosp_atd + channel: canary # Necessary for ATDs + arch: x86_64 + force-avd-creation: false + disable-animations: true + disable-spellchecker: true + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disk-size: 4096M + script: echo "Generated AVD snapshot for caching." + # Clean, build and release a test apk - name: Make assembleUiTests run: make assembleUiTests @@ -63,13 +82,13 @@ jobs: uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # pin@v2 with: api-level: 30 + target: aosp_atd + channel: canary # Necessary for ATDs + arch: x86_64 force-avd-creation: false - emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true disable-spellchecker: true - target: 'aosp_atd' - arch: x86 - channel: canary # Necessary for ATDs + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disk-size: 4096M script: ./gradlew sentry-android-integration-tests:sentry-uitest-android:connectedReleaseAndroidTest -DtestBuildType=release -Denvironment=github --daemon diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index a5b91290c9..abc5ab1f4a 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -79,17 +79,36 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Setup KVM - shell: bash + - name: Enable KVM run: | - # check if virtualization is supported... - sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok - # allow access to KVM to run the emulator - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ - | sudo tee /etc/udev/rules.d/99-kvm4all.rules + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules 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-api-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }} + + - name: Create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # pin@v2 + with: + api-level: ${{ matrix.api-level }} + target: ${{ matrix.target }} + channel: ${{ matrix.channel }} + arch: ${{ matrix.arch }} + force-avd-creation: false + disable-animations: true + disable-spellchecker: true + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disk-size: 4096M + script: echo "Generated AVD snapshot for caching." + - name: Download APK artifact uses: actions/download-artifact@v5 with: @@ -104,21 +123,13 @@ jobs: uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # pin@v2.34.0 with: api-level: ${{ matrix.api-level }} - force-avd-creation: false - disable-animations: true - disable-spellchecker: true target: ${{ matrix.target }} channel: ${{ matrix.channel }} arch: ${{ matrix.arch }} - emulator-options: > - -no-window - -no-snapshot-save - -gpu swiftshader_indirect - -noaudio - -no-boot-anim - -camera-back none - -camera-front none - -timezone US/Pacific + force-avd-creation: false + disable-animations: true + disable-spellchecker: true + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot-save script: | adb install -r -d "${{env.APK_NAME}}" maestro test "${{env.BASE_PATH}}/maestro" --debug-output "${{env.BASE_PATH}}/maestro-logs"