Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cbf6323
Make emulator startup and provisioning more robust
kubaflo Mar 3, 2026
5064c10
Remove iOS-specific Start-Emulator.ps1 changes
github-actions[bot] Mar 4, 2026
ffb5175
Simplify ci-copilot.yml: reuse enable-kvm, provision, Cake boot, and …
github-actions[bot] Mar 4, 2026
8ea0729
Align ci-copilot.yml Android emulator setup with device-tests/uitests
github-actions[bot] Mar 4, 2026
e028076
Fix: Add ANDROID_SDK_ROOT/platform-tools to PATH for adb access
github-actions[bot] Mar 4, 2026
be08f8d
Switch pool to Linux ubuntu-22.04 to match device-tests/uitests
github-actions[bot] Mar 4, 2026
209e98a
Fix: Wait for emulator boot after Cake launches it in background
github-actions[bot] Mar 5, 2026
90a6015
Fix: Add Android SDK platform-tools to PATH in wait step
github-actions[bot] Mar 5, 2026
f14d934
Fix: Replace Cake boot with direct emulator launch
github-actions[bot] Mar 5, 2026
53ecc41
Fix: Add -partition-size 2048 for limited disk on hosted agents
github-actions[bot] Mar 5, 2026
472d05b
Fix: Reduce AVD disk.dataPartition.size in config.ini after creation
github-actions[bot] Mar 5, 2026
8869d1a
Fix: Free disk space before emulator launch on hosted agents
github-actions[bot] Mar 5, 2026
2797816
Fix: Restart adb server before emulator, use adb wait-for-device
github-actions[bot] Mar 5, 2026
aa25cdb
Fix: Use GH_TOKEN env var for gh auth on Linux
github-actions[bot] Mar 5, 2026
e6b4066
Fix: Handle GNU vs BSD sed for Linux/macOS compatibility
github-actions[bot] Mar 5, 2026
4d1ab47
Fix: Ensure Copilot CLI npm bin is on PATH for subsequent steps
github-actions[bot] Mar 5, 2026
5e31b52
Fix: Explicitly add copilot to PATH in PR reviewer step
github-actions[bot] Mar 5, 2026
589da33
Fix: Symlink copilot to /usr/local/bin and use pwsh -NoProfile
github-actions[bot] Mar 5, 2026
1d5f709
Fix: Use Get-Command for Copilot CLI detection in Review-PR.ps1
github-actions[bot] Mar 5, 2026
609b94c
Fix: Upgrade Node.js to v24 for Copilot CLI requirement
github-actions[bot] Mar 5, 2026
63cb319
Fix: AVD name truncation bug in Start-Emulator.ps1
github-actions[bot] Mar 5, 2026
e93d97a
Fix: Add emulator CI preparation to prevent ANR
github-actions[bot] Mar 5, 2026
0598911
Fix: Add emulator warmup step before agent to prevent SystemUI ANR
github-actions[bot] Mar 5, 2026
055a5d4
Fix: APK install retry (P1) and ANR dialog dismissal (P2)
github-actions[bot] Mar 10, 2026
4691170
Fix: Add emulator boot retry loop and step-level retry
github-actions[bot] Mar 11, 2026
dc1ed21
Increase job timeout to 360 minutes for complex PRs
github-actions[bot] Mar 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/scripts/BuildAndRunHostApp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,28 @@ if ($Category) {
if ($Platform -eq "android") {
Write-Info "Clearing Android logcat buffer before test..."
& adb -s $DeviceUdid logcat -c

# Dismiss any ANR dialogs that may have appeared during build/deploy.
# The emulator can sit idle during long builds, causing SystemUI ANR.
Write-Info "Dismissing any system dialogs before test..."
& adb -s $DeviceUdid shell am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS 2>$null
& adb -s $DeviceUdid shell input keyevent KEYCODE_ENTER 2>$null
& adb -s $DeviceUdid shell input keyevent KEYCODE_BACK 2>$null
Start-Sleep -Seconds 1
& adb -s $DeviceUdid shell input keyevent KEYCODE_WAKEUP 2>$null
& adb -s $DeviceUdid shell input keyevent KEYCODE_MENU 2>$null
Start-Sleep -Seconds 1

# Check for lingering ANR dialogs via window dump
$windowDump = & adb -s $DeviceUdid shell dumpsys window 2>$null | Select-String "Application Not Responding|ANR"
if ($windowDump) {
Write-Warn "ANR dialog detected — force-dismissing..."
& adb -s $DeviceUdid shell input keyevent KEYCODE_HOME 2>$null
Start-Sleep -Seconds 2
& adb -s $DeviceUdid shell am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS 2>$null
& adb -s $DeviceUdid shell input keyevent KEYCODE_BACK 2>$null
Start-Sleep -Seconds 1
}
}

# Capture test start time for iOS logs
Expand Down
8 changes: 5 additions & 3 deletions .github/scripts/Review-PR.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,14 @@ if (-not $ghVersion) {
}
Write-Host " ✅ GitHub CLI: $ghVersion" -ForegroundColor Green

# Check Copilot CLI
$copilotVersion = copilot --version 2>$null
if (-not $copilotVersion) {
# Check Copilot CLI - use Get-Command (reliable) then get version with merged streams
$copilotCmd = Get-Command copilot -ErrorAction SilentlyContinue
if (-not $copilotCmd) {
Write-Error "Copilot CLI is not installed. Install with: npm install -g @github/copilot"
exit 1
}
$copilotVersion = (& copilot --version 2>&1 | Out-String).Trim()
if (-not $copilotVersion) { $copilotVersion = $copilotCmd.Source }
Write-Host " ✅ Copilot CLI: $copilotVersion" -ForegroundColor Green

# Check PR exists
Expand Down
49 changes: 43 additions & 6 deletions .github/scripts/shared/Build-AndDeploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,56 @@ if ($Platform -eq "android") {
Write-Info "Build command: dotnet build $($buildArgs -join ' ')"

$buildStartTime = Get-Date
$maxAttempts = 2
$buildExitCode = 1

for ($attempt = 1; $attempt -le $maxAttempts; $attempt++) {
if ($attempt -gt 1) {
Write-Warn "Retrying build/deploy (attempt $attempt of $maxAttempts)..."

# Uninstall any MAUI test packages to clear bad state
$installedPkg = & adb shell pm list packages 2>$null | Select-String "maui" | ForEach-Object { ($_ -replace "package:", "").Trim() }
if ($installedPkg) {
foreach ($pkg in $installedPkg) {
Write-Info "Uninstalling $pkg before retry..."
& adb uninstall $pkg 2>$null
}
}

# Restart ADB server to recover from broken pipe / transient errors
Write-Info "Restarting ADB server..."
& adb kill-server 2>$null
Start-Sleep -Seconds 2
& adb start-server
Start-Sleep -Seconds 2
& adb wait-for-device
Start-Sleep -Seconds 3
}

& dotnet build @buildArgs
$buildExitCode = $LASTEXITCODE

if ($buildExitCode -eq 0) {
break
}

if ($attempt -lt $maxAttempts) {
Write-Warn "Build/deploy failed (attempt $attempt). ADB0010/broken-pipe errors are transient on API 30 — will retry."
}
}

# Build and deploy in one step (Run target handles both)
& dotnet build @buildArgs

$buildExitCode = $LASTEXITCODE
$buildDuration = (Get-Date) - $buildStartTime

if ($buildExitCode -ne 0) {
Write-Error "Build/deploy failed with exit code $buildExitCode"
Write-Error "Build/deploy failed after $maxAttempts attempts with exit code $buildExitCode"
exit $buildExitCode
}

Write-Success "Build and deploy completed in $($buildDuration.TotalSeconds) seconds"
if ($attempt -gt 1) {
Write-Success "Build and deploy succeeded on attempt $attempt in $($buildDuration.TotalSeconds) seconds"
} else {
Write-Success "Build and deploy completed in $($buildDuration.TotalSeconds) seconds"
}

#endregion

Expand Down
14 changes: 8 additions & 6 deletions .github/scripts/shared/Start-Emulator.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ if ($Platform -eq "android") {
# Check if DeviceUdid is an AVD name (not an emulator-XXXX format)
if ($DeviceUdid -and $DeviceUdid -notmatch "^emulator-\d+$") {
# DeviceUdid is likely an AVD name - check if it's in the AVD list
$avdList = emulator -list-avds 2>$null
# Force array output - single AVD returns a string which breaks -contains
[string[]]$avdList = @(emulator -list-avds 2>$null)
if ($avdList -contains $DeviceUdid) {
Write-Info "DeviceUdid '$DeviceUdid' is an AVD name. Will boot this emulator..."
$selectedAvd = $DeviceUdid
Expand Down Expand Up @@ -103,7 +104,8 @@ if ($Platform -eq "android") {

# Get list of available AVDs (if not already set from parameter)
if (-not $selectedAvd) {
$avdList = emulator -list-avds 2>$null
# Force array output - single AVD returns a string which breaks indexing
[string[]]$avdList = @(emulator -list-avds 2>$null)

if (-not $avdList -or $avdList.Count -eq 0) {
Write-Error "No Android emulators found. Please create an Android Virtual Device (AVD) using Android Studio."
Expand All @@ -119,7 +121,7 @@ if ($Platform -eq "android") {
# Selection priority:
# 1. API 34 device (matches CI provisioning)
# 2. API 30 Nexus device
# 3. Any API 30 device
# 3. Any API 30 device (matches names like "Emulator_30", "API_30_xxx", etc.)
# 4. Any Nexus device
# 5. First available device

Expand All @@ -132,16 +134,16 @@ if ($Platform -eq "android") {

# Try to find API 30 Nexus device
if (-not $selectedAvd) {
$api30Nexus = $avdList | Where-Object { $_ -match "API.*30" -and $_ -match "Nexus" } | Select-Object -First 1
$api30Nexus = $avdList | Where-Object { $_ -match "30" -and $_ -match "Nexus" } | Select-Object -First 1
if ($api30Nexus) {
$selectedAvd = $api30Nexus
Write-Info "Selected API 30 Nexus device: $selectedAvd"
}
}

# Try to find any API 30 device
# Try to find any API 30 device (match "30" anywhere in name)
if (-not $selectedAvd) {
$api30Device = $avdList | Where-Object { $_ -match "API.*30" } | Select-Object -First 1
$api30Device = $avdList | Where-Object { $_ -match "30" } | Select-Object -First 1
if ($api30Device) {
$selectedAvd = $api30Device
Write-Info "Selected API 30 device: $selectedAvd"
Expand Down
Loading
Loading