Skip to content

Instantly share code, notes, and snippets.

@m-malkowski
Created May 10, 2017 14:56
Show Gist options
  • Select an option

  • Save m-malkowski/67d63d9befee1b77d91d37280e3be130 to your computer and use it in GitHub Desktop.

Select an option

Save m-malkowski/67d63d9befee1b77d91d37280e3be130 to your computer and use it in GitHub Desktop.
param(
[string]
$ResultsFile,
[string]
$ResultsType = "mstest"
)
$ResultsFile = Resolve-Path $ResultsFile
$Url = "https://ci.appveyor.com/api/testresults/$ResultsType/$($env:APPVEYOR_JOB_ID)"
if(-Not (Test-Path $ResultsFile))
{
Write-Host "File '$ResultsFile' not found"
exit(1)
}
# upload results to AppVeyor
try
{
$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile($Url, $ResultsFile)
Write-Host "Tests result uploaded correctly to $($Url)"
}
catch
{
Write-Host "Error uploading tests results to $Url"
$Exception = $_.Exception
while($null -ne $Exception)
{
Write-Host "Error: $($Exception.Message)"
$Exception = $Exception.InnerException
}
exit(2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment