Skip to content

Commit ea9f928

Browse files
add retry to legacty tests fragile step (#176)
* add retry to legacty tests fragile step
1 parent 488acbe commit ea9f928

File tree

1 file changed

+38
-33
lines changed

1 file changed

+38
-33
lines changed

.github/workflows/legacy-tests.yml

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -56,39 +56,44 @@ jobs:
5656
PGSERVICE: ${{ steps.postgres.outputs.service-name }}
5757
PGPASSWORD: ${{ env.POSTGRES_PASSWORD }}
5858

59-
- name: Install MySQL and restore test projects in parallel
60-
shell: pwsh
61-
run: |
62-
$mysqlJob = Start-Job -ScriptBlock {
63-
choco install mysql --no-progress --version=8.0.31 -y --params "/serviceName:MySQL"
64-
return $LASTEXITCODE
65-
}
66-
67-
$restoreJob = Start-Job -ScriptBlock {
68-
Get-ChildItem -Path examples -Recurse -Filter *.csproj |
69-
Where-Object { $_.FullName -like '*Legacy*' } |
70-
ForEach-Object { nuget restore $_.FullName }
71-
nuget restore ./EndToEndCommon/EndToEndCommon.csproj
72-
nuget restore ./LegacyEndToEndTests/LegacyEndToEndTests.csproj
73-
msbuild.exe ./LegacyEndToEndTests/LegacyEndToEndTests.csproj -p:Configuration=Release -p:FrameworkVersion=v4.7.2
74-
return $LASTEXITCODE
75-
}
76-
77-
Wait-Job -Job $mysqlJob, $restoreJob
78-
79-
$mysqlOutput = Receive-Job -Job $mysqlJob
80-
$mysqlExitCode = @($mysqlOutput)[-1]
81-
if ($mysqlExitCode -ne 0) {
82-
Write-Error "MySQL install failed with exit code: $mysqlExitCode"
83-
return $mysqlExitCode
84-
}
85-
86-
$restoreOutput = Receive-Job -Job $restoreJob
87-
$restoreExitCode = @($restoreOutput)[-1]
88-
if ($restoreExitCode -ne 0) {
89-
Write-Error "Restore/build failed with exit code: $restoreExitCode"
90-
return $restoreExitCode
91-
}
59+
- uses: nick-fields/retry@v3
60+
name: Install MySQL and restore test projects in parallel (with retry)
61+
with:
62+
retry_on: error
63+
max_attempts: 2
64+
timeout_minutes: 7
65+
shell: pwsh
66+
command: |
67+
$mysqlJob = Start-Job -ScriptBlock {
68+
choco install mysql --no-progress --version=8.0.31 -y --params "/serviceName:MySQL"
69+
return $LASTEXITCODE
70+
}
71+
72+
$restoreJob = Start-Job -ScriptBlock {
73+
Get-ChildItem -Path examples -Recurse -Filter *.csproj |
74+
Where-Object { $_.FullName -like '*Legacy*' } |
75+
ForEach-Object { nuget restore $_.FullName }
76+
nuget restore ./EndToEndCommon/EndToEndCommon.csproj
77+
nuget restore ./LegacyEndToEndTests/LegacyEndToEndTests.csproj
78+
msbuild.exe ./LegacyEndToEndTests/LegacyEndToEndTests.csproj -p:Configuration=Release -p:FrameworkVersion=v4.7.2
79+
return $LASTEXITCODE
80+
}
81+
82+
Wait-Job -Job $mysqlJob, $restoreJob
83+
84+
$mysqlOutput = Receive-Job -Job $mysqlJob
85+
$mysqlExitCode = @($mysqlOutput)[-1]
86+
if ($mysqlExitCode -ne 0) {
87+
Write-Error "MySQL install failed with exit code: $mysqlExitCode"
88+
return $mysqlExitCode
89+
}
90+
91+
$restoreOutput = Receive-Job -Job $restoreJob
92+
$restoreExitCode = @($restoreOutput)[-1]
93+
if ($restoreExitCode -ne 0) {
94+
Write-Error "Restore/build failed with exit code: $restoreExitCode"
95+
return $restoreExitCode
96+
}
9297

9398
- name: Init MySQL Schema
9499
shell: powershell

0 commit comments

Comments
 (0)