refactor(distribution): Use interface pattern for distribution API #3305
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: UI Tests Critical | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
BASE_PATH: "sentry-android-integration-tests/sentry-uitest-android-critical" | |
BUILD_PATH: "build/outputs/apk/release" | |
APK_NAME: "sentry-uitest-android-critical-release.apk" | |
APK_ARTIFACT_NAME: "sentry-uitest-android-critical-release" | |
MAESTRO_VERSION: "1.39.0" | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
env: | |
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- name: Set up Java 17 | |
uses: actions/setup-java@v5 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a | |
with: | |
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
- name: Build debug APK | |
run: make assembleUiTestCriticalRelease | |
- name: Upload APK artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{env.APK_ARTIFACT_NAME}} | |
path: "${{env.BASE_PATH}}/${{env.BUILD_PATH}}/${{env.APK_NAME}}" | |
retention-days: 1 | |
run-maestro-tests: | |
name: Run Tests for API Level ${{ matrix.api-level }} | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
# we want that the matrix keeps running, default is to cancel them if it fails. | |
fail-fast: false | |
matrix: | |
include: | |
- api-level: 31 # Android 12 | |
target: aosp_atd | |
channel: canary # Necessary for ATDs | |
arch: x86_64 | |
- api-level: 33 # Android 13 | |
target: aosp_atd | |
channel: canary # Necessary for ATDs | |
arch: x86_64 | |
- api-level: 34 # Android 14 | |
target: aosp_atd | |
channel: canary # Necessary for ATDs | |
arch: x86_64 | |
- api-level: 35 # Android 15 | |
target: aosp_atd | |
channel: canary # Necessary for ATDs | |
arch: x86_64 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- name: Enable KVM | |
run: | | |
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: | |
name: ${{env.APK_ARTIFACT_NAME}} | |
- name: Install Maestro | |
uses: dniHze/maestro-test-action@bda8a93211c86d0a05b7a4597c5ad134566fbde4 # [email protected] | |
with: | |
version: ${{env.MAESTRO_VERSION}} | |
- name: Run tests | |
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # [email protected] | |
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 -no-snapshot-save | |
script: | | |
adb uninstall io.sentry.uitest.android.critical || echo "Already uninstalled (or not found)" | |
adb install -r -d "${{env.APK_NAME}}" | |
maestro test "${{env.BASE_PATH}}/maestro" --debug-output "${{env.BASE_PATH}}/maestro-logs" | |
- name: Upload Maestro test results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: maestro-logs | |
path: "${{env.BASE_PATH}}/maestro-logs" | |
retention-days: 1 |