Skip to content

fix: Flaky iOS smoke tests #1969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ jobs:

- name: iOS smoke test
if: ${{ matrix.platform == 'iOS' }}
run: ./scripts/smoke-test-ios.ps1 Build -IsIntegrationTest -UnityVersion "${{ matrix.unity-version }}"
run: ./scripts/smoke-test-ios.ps1 Build -IsIntegrationTest -UnityVersion "${{ matrix.unity-version }}" -iOSMinVersion "16.1"
timeout-minutes: 10

- name: Upload integration-test project on failure
Expand Down Expand Up @@ -579,7 +579,7 @@ jobs:

- name: Smoke test
id: smoke-test-ios
timeout-minutes: 10
timeout-minutes: 20
run: |
$runtime = "${{ matrix.ios }}"
If ($runtime -ne "latest")
Expand Down
61 changes: 30 additions & 31 deletions scripts/smoke-test-ios.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ param (
[string] $SelectedRuntime,
[Int32] $DevicesToRun = 1,
[Switch] $IsIntegrationTest,
[string] $UnityVersion = ""
[string] $UnityVersion = "",
[string] $iOSMinVersion = ""
)
Write-Host "Args received Action=$Action, SelectedRuntime=$SelectedRuntime, IsIntegrationTest=$IsIntegrationTest"
# $Action: 'Build' for build only
Expand Down Expand Up @@ -60,6 +61,9 @@ function Build()
-scheme "Unity-iPhone" `
-configuration "Release" `
-sdk "iphonesimulator" `
-destination "platform=iOS Simulator,OS=$iOSMinVersion" `
-destination "platform=iOS Simulator,OS=latest" `
-parallel-testing-enabled YES `
-derivedDataPath "$ArchivePath/$ProjectName" `
| Write-Host
}
Expand All @@ -84,9 +88,10 @@ function Test
{
Write-Host "Retrieving list of available simulators" -ForegroundColor Green
$deviceListRaw = xcrun simctl list devices
Write-Host "Available simulators:" -ForegroundColor Green
Write-Host "::group::Available simulators:"
$deviceListRaw | Write-Host

Write-Host "::endgroup::"

[AppleDevice[]]$deviceList = @()

Write-Host "Picking simulator based on selected runtime" -ForegroundColor Green
Expand Down Expand Up @@ -142,39 +147,33 @@ function Test

function RunTest([string] $Name, [string] $SuccessString)
{
Write-Host "::group::Test: '$name'"
try
{
Write-Host "Launching '$Name' test on '$($device.Name)'" -ForegroundColor Green
$consoleOut = xcrun simctl launch --console-pty $($device.UUID) $AppName "--test" $Name
Write-Host "Test: '$name'"
Write-Host "Launching '$Name' test on '$($device.Name)'" -ForegroundColor Green
$consoleOut = xcrun simctl launch --console-pty $($device.UUID) $AppName "--test" $Name

if ("$SuccessString" -eq "")
{
$SuccessString = "$($Name.ToUpper()) TEST: PASS"
}
if ("$SuccessString" -eq "")
{
$SuccessString = "$($Name.ToUpper()) TEST: PASS"
}

Write-Host -NoNewline "'$Name' test STATUS: "
$stdout = $consoleOut | Select-String $SuccessString
If ($null -ne $stdout)
{
Write-Host "PASSED" -ForegroundColor Green
}
Else
{
$device.TestFailed = $True
Write-Host "FAILED" -ForegroundColor Red
Write-Host "===== START OF '$($device.Name)' CONSOLE ====="
foreach ($consoleLine in $consoleOut)
{
Write-Host $consoleLine
}
Write-Host " ===== END OF CONSOLE ====="
}
Write-Host -NoNewline "'$Name' test STATUS: "
$stdout = $consoleOut | Select-String $SuccessString
If ($null -ne $stdout)
{
Write-Host "PASSED" -ForegroundColor Green
}
finally
Else
{
Write-Host "::endgroup::"
$device.TestFailed = $True
Write-Host "FAILED" -ForegroundColor Red
}

Write-Host "::group::$($device.Name) Console Output"
foreach ($consoleLine in $consoleOut)
{
Write-Host $consoleLine
}
Write-Host "::endgroup::"
}

RunTest "smoke"
Expand Down
Loading