1- name : Run Windows Build
1+ name : Run Demo Builds
22
33on :
44 workflow_call :
@@ -53,4 +53,109 @@ jobs:
5353 } else {
5454 Write-Error "No SentaurSurvivors executable found in build artifacts"
5555 exit 1
56- }
56+ }
57+
58+ test-android :
59+ name : Test Android Build
60+ runs-on : ubuntu-latest
61+
62+ steps :
63+ - name : Download Android Build
64+ uses : actions/download-artifact@v4
65+ with :
66+ name : Build-Android
67+ path : ./build
68+ github-token : ${{ secrets.GITHUB_TOKEN }}
69+ run-id : ${{ github.event_name == 'workflow_run' && github.event.workflow_run.id || github.run_id }}
70+
71+ - name : Set up JDK 17
72+ uses : actions/setup-java@v4
73+ with :
74+ java-version : ' 17'
75+ distribution : ' temurin'
76+
77+ - name : Enable KVM group perms
78+ run : |
79+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
80+ sudo udevadm control --reload-rules
81+ sudo udevadm trigger --name-match=kvm
82+
83+ - name : Set up Android SDK
84+ uses : android-actions/setup-android@v3
85+
86+ - name : AVD cache
87+ uses : actions/cache@v4
88+ id : avd-cache
89+ with :
90+ path : |
91+ ~/.android/avd/*
92+ ~/.android/adb*
93+ key : avd-29
94+
95+ - name : Create AVD and generate snapshot for caching
96+ if : steps.avd-cache.outputs.cache-hit != 'true'
97+ uses : reactivecircus/android-emulator-runner@v2
98+ with :
99+ api-level : 29
100+ target : google_apis
101+ arch : x86_64
102+ profile : Nexus 6
103+ force-avd-creation : false
104+ emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
105+ disable-animations : false
106+ script : echo "Generated AVD snapshot for caching."
107+
108+ - name : Find APK file
109+ id : find-apk
110+ run : |
111+ APK_FILE=$(find ./build -name "*.apk" -type f | head -1)
112+ if [ -z "$APK_FILE" ]; then
113+ echo "Error: No APK file found in build artifacts"
114+ exit 1
115+ fi
116+ echo "Found APK: $APK_FILE"
117+ echo "apk_path=$APK_FILE" >> $GITHUB_OUTPUT
118+
119+ - name : Run Android Emulator
120+ uses : reactivecircus/android-emulator-runner@v2
121+ env :
122+ SENTRY_DSN : ${{ secrets.DSN }}
123+ with :
124+ api-level : 29
125+ target : google_apis
126+ arch : x86_64
127+ profile : Nexus 6
128+ emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
129+ disable-animations : true
130+ script : |
131+ echo "Installing APK..."
132+ adb install "${{ steps.find-apk.outputs.apk_path }}"
133+
134+ echo "Starting app..."
135+ # Get package name from APK
136+ PACKAGE_NAME=$(aapt dump badging "${{ steps.find-apk.outputs.apk_path }}" | grep package | awk '{print $2}' | sed "s/name='//" | sed "s/'.*//")
137+ echo "Package name: $PACKAGE_NAME"
138+
139+ # Get main activity
140+ MAIN_ACTIVITY=$(aapt dump badging "${{ steps.find-apk.outputs.apk_path }}" | grep "launchable-activity" | awk '{print $2}' | sed "s/name='//" | sed "s/'.*//")
141+ echo "Main activity: $MAIN_ACTIVITY"
142+
143+ # Pass DSN as Intent extra for Android runtime configuration
144+ adb shell am start -n $PACKAGE_NAME/$MAIN_ACTIVITY --es dsn "$SENTRY_DSN"
145+
146+ echo "App started, waiting for execution..."
147+ sleep 5
148+
149+ # Check if app is running
150+ adb shell "ps | grep $PACKAGE_NAME" || echo "App might not be running"
151+
152+ echo "Waiting for app to initialize..."
153+ sleep 25
154+
155+ echo "Capturing logs..."
156+ adb logcat -d | grep -i "unity\|sentry\|sentaur\|dsn\|configure" || echo "No relevant logs found"
157+
158+ echo "Stopping app..."
159+ adb shell am force-stop $PACKAGE_NAME
160+
161+ echo "Android demo completed successfully"
0 commit comments