diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index 02d6c219e..a2593c164 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -36,8 +36,39 @@ function Update-AppVeyorTestResults if($env:Appveyor) { - $resolvedResultsPath = (Resolve-Path $resultsFile) - (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", $resolvedResultsPath) + $retryCount = 0 + $pushedResults = $false + $pushedArtifacts = $false + while( (!$pushedResults -or !$pushedResults) -and $retryCount -lt 3) + { + if($retryCount -gt 0) + { + Write-Verbose "Retrying updating test artifacts..." + } + + $retryCount++ + $resolvedResultsPath = (Resolve-Path $resultsFile) + try { + (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", $resolvedResultsPath) + $pushedResults = $true + } + catch { + Write-Warning "Pushing test result failed..." + } + + try { + Push-AppveyorArtifact $resolvedResultsPath + $pushedArtifacts = $true + } + catch { + Write-Warning "Pushing test Artifact failed..." + } + } + + if(!$pushedResults -or !$pushedResults) + { + Write-Warning "Failed to push all artifacts for $resultsFile" + } } else {