|
| 1 | +name: UI Tests Critical |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +env: |
| 14 | + BASE_PATH: "sentry-android-integration-tests/sentry-uitest-android-critical" |
| 15 | + BUILD_PATH: "build/outputs/apk/release" |
| 16 | + APK_NAME: "sentry-uitest-android-critical-release.apk" |
| 17 | + APK_ARTIFACT_NAME: "sentry-uitest-android-critical-release" |
| 18 | + MAESTRO_VERSION: "1.39.0" |
| 19 | + |
| 20 | +jobs: |
| 21 | + build: |
| 22 | + name: Build |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - name: Checkout code |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Set up Java 17 |
| 29 | + uses: actions/setup-java@v4 |
| 30 | + with: |
| 31 | + distribution: 'temurin' |
| 32 | + java-version: '17' |
| 33 | + |
| 34 | + - name: Setup Gradle |
| 35 | + uses: gradle/actions/setup-gradle@4ba34e96c5f6493e99d0696180a9a8d431577ba9 # pin@v3 |
| 36 | + with: |
| 37 | + gradle-home-cache-cleanup: true |
| 38 | + |
| 39 | + - name: Build debug APK |
| 40 | + run: make assembleUiTestCriticalRelease |
| 41 | + |
| 42 | + - name: Upload APK artifact |
| 43 | + uses: actions/upload-artifact@v4 |
| 44 | + with: |
| 45 | + name: ${{env.APK_ARTIFACT_NAME}} |
| 46 | + path: "${{env.BASE_PATH}}/${{env.BUILD_PATH}}/${{env.APK_NAME}}" |
| 47 | + retention-days: 1 |
| 48 | + |
| 49 | + run-maestro-tests: |
| 50 | + name: Run Tests for API Level ${{ matrix.api-level }} |
| 51 | + needs: build |
| 52 | + runs-on: ubuntu-latest |
| 53 | + strategy: |
| 54 | + # we want that the matrix keeps running, default is to cancel them if it fails. |
| 55 | + fail-fast: false |
| 56 | + matrix: |
| 57 | + include: |
| 58 | + - api-level: 30 # Android 11 |
| 59 | + target: aosp_atd |
| 60 | + channel: canary # Necessary for ATDs |
| 61 | + arch: x86_64 |
| 62 | + - api-level: 31 # Android 12 |
| 63 | + target: aosp_atd |
| 64 | + channel: canary # Necessary for ATDs |
| 65 | + arch: x86_64 |
| 66 | + - api-level: 33 # Android 13 |
| 67 | + target: aosp_atd |
| 68 | + channel: canary # Necessary for ATDs |
| 69 | + arch: x86_64 |
| 70 | + - api-level: 34 # Android 14 |
| 71 | + target: aosp_atd |
| 72 | + channel: canary # Necessary for ATDs |
| 73 | + arch: x86_64 |
| 74 | + steps: |
| 75 | + - name: Checkout code |
| 76 | + uses: actions/checkout@v4 |
| 77 | + |
| 78 | + - name: Setup KVM |
| 79 | + shell: bash |
| 80 | + run: | |
| 81 | + # check if virtualization is supported... |
| 82 | + sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok |
| 83 | + # allow access to KVM to run the emulator |
| 84 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ |
| 85 | + | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 86 | + sudo udevadm control --reload-rules |
| 87 | + sudo udevadm trigger --name-match=kvm |
| 88 | +
|
| 89 | + - name: Download APK artifact |
| 90 | + uses: actions/download-artifact@v4 |
| 91 | + with: |
| 92 | + name: ${{env.APK_ARTIFACT_NAME}} |
| 93 | + |
| 94 | + - name: Install Maestro |
| 95 | + uses: dniHze/maestro-test-action@bda8a93211c86d0a05b7a4597c5ad134566fbde4 # [email protected] |
| 96 | + with: |
| 97 | + version: ${{env.MAESTRO_VERSION}} |
| 98 | + |
| 99 | + - name: Run tests |
| 100 | + uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # [email protected] |
| 101 | + with: |
| 102 | + api-level: ${{ matrix.api-level }} |
| 103 | + force-avd-creation: false |
| 104 | + disable-animations: true |
| 105 | + disable-spellchecker: true |
| 106 | + target: ${{ matrix.target }} |
| 107 | + channel: ${{ matrix.channel }} |
| 108 | + arch: ${{ matrix.arch }} |
| 109 | + emulator-options: > |
| 110 | + -no-window |
| 111 | + -no-snapshot-save |
| 112 | + -gpu swiftshader_indirect |
| 113 | + -noaudio |
| 114 | + -no-boot-anim |
| 115 | + -camera-back none |
| 116 | + -camera-front none |
| 117 | + -timezone US/Pacific |
| 118 | + script: | |
| 119 | + adb install -r -d "${{env.APK_NAME}}" |
| 120 | + maestro test "${{env.BASE_PATH}}/maestro" --debug-output "${{env.BASE_PATH}}/maestro-logs" |
| 121 | +
|
| 122 | + - name: Upload Maestro test results |
| 123 | + if: failure() |
| 124 | + uses: actions/upload-artifact@v4 |
| 125 | + with: |
| 126 | + name: maestro-logs |
| 127 | + path: "${{env.BASE_PATH}}/maestro-logs" |
| 128 | + retention-days: 1 |
0 commit comments