-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix broken output case, refactor actions, add case for wrong activity
- Loading branch information
1 parent
6df3fb7
commit 104ecd9
Showing
3 changed files
with
95 additions
and
45 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,9 @@ on: | |
type: number | ||
# Map the workflow outputs to job outputs | ||
outputs: | ||
outcome: | ||
description: | ||
value: ${{ jobs.run.outputs.outcome }} | ||
status: | ||
description: "The outcome status of the smoke test" | ||
value: ${{ jobs.run.outputs.status }} | ||
|
||
jobs: | ||
run: | ||
|
@@ -31,21 +31,21 @@ jobs: | |
outcome: ${{ steps.smoke-test.outcome }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Download test app artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: testapp-Android-compiled-${{ inputs.unity-version }} | ||
path: samples/IntegrationTest/Build | ||
|
||
uses: actions/checkout@v4 | ||
|
||
# Not required for MacOS. | ||
- name: Enable KVM group perms | ||
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: Download test app artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: testapp-Android-compiled-${{ inputs.unity-version }} | ||
path: samples/IntegrationTest/Build | ||
|
||
# outputs variables: api-level, label, target | ||
- name: Configure Android Settings | ||
id: config | ||
|
@@ -72,34 +72,11 @@ jobs: | |
"api-level=$apiLevel" >> $env:GITHUB_OUTPUT | ||
"label=$($label ?? $apiLevel)" >> $env:GITHUB_OUTPUT | ||
- name: Set up JDK 17 | ||
if: steps.avd-cache.outputs.cache-hit == '2' | ||
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b | ||
with: | ||
java-version: 17 | ||
distribution: 'adopt' | ||
|
||
- name: Setup Android SDK | ||
uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407 | ||
|
||
- name: Gradle cache | ||
uses: gradle/actions/setup-gradle@d0a116fff52a680bc1541b7c4c87ca37d30abf00 | ||
|
||
- name: AVD cache | ||
if: steps.avd-cache.outputs.cache-hit == '2' | ||
uses: actions/cache@v4 | ||
id: avd-cache | ||
with: | ||
path: | | ||
~/.android/avd/* | ||
~/.android/adb* | ||
key: avd-${{ steps.config.outputs.api-level }} | ||
|
||
- name: create Android Emulator Image | ||
if: steps.avd-cache.outputs.cache-hit != 'true' | ||
- name: create Android Emulator Image | ||
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b # [email protected] | ||
with: | ||
api-level: ${{ steps.config.outputs.api-level }} | ||
target: ${{ steps.config.outputs.target }} | ||
force-avd-creation: false | ||
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: false | ||
|
@@ -108,9 +85,31 @@ jobs: | |
adb wait-for-device | ||
adb shell input keyevent 82 | ||
adb devices -l | ||
gradle connectedAndroidTest --continue | ||
echo "Generated AVD snapshot for caching." | ||
- name: Wait for Emulator to Close | ||
env: | ||
EMULATOR_NAME: emulator-5554 | ||
run: | | ||
Write-Output "Waiting for emulator $env:EMULATOR_NAME to close..." | ||
$retries = 0 | ||
$maxRetries = 60 # Adjust timeout (60 x 5 seconds = 5 minutes) | ||
while ($true) { | ||
$devices = adb devices | Select-String -Pattern $env:EMULATOR_NAME | ||
if (-not $devices) { | ||
Write-Output "Emulator $env:EMULATOR_NAME is offline." | ||
break | ||
} | ||
if ($retries -ge $maxRetries) { | ||
Write-Error "Timeout: Emulator $env:EMULATOR_NAME did not go offline after $(($maxRetries * 5)) seconds." | ||
exit 1 | ||
} | ||
Write-Output "Emulator $env:EMULATOR_NAME is still running. Retrying in 5 seconds... ($retries/$maxRetries)" | ||
Start-Sleep -Seconds 5 | ||
$retries++ | ||
} | ||
- name: Android API ${{ steps.config.outputs.label }} Smoke test | ||
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b # [email protected] | ||
id: smoke-test | ||
|
This file contains 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