From ff298d0811537f8e053834bf792cd2dbd26e09be Mon Sep 17 00:00:00 2001 From: Luigi Grilli Date: Sun, 12 Jun 2016 08:55:09 +0100 Subject: [PATCH] Appveyor build improvements Appveyor build improvements: - added nuget packages folder to cache to speedup build - all unit tests are now showing up in the tests tab --- appveyor.yml | 12 +++++++----- build/uploadtests.ps1 | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 build/uploadtests.ps1 diff --git a/appveyor.yml b/appveyor.yml index 01d21e2df..114cd8187 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,6 +17,8 @@ skip_tags: true #---------------------------------# # environment configuration # #---------------------------------# +cache: + - packages # scripts that are called at very beginning, before repo cloning init: @@ -62,14 +64,14 @@ after_build: #---------------------------------# # tests configuration # #---------------------------------# -before_test: - - dotnet test .\BenchmarkDotNet.Tests\project.json --configuration Release - - dotnet test .\BenchmarkDotNet.IntegrationTests\project.json --configuration Release +test_script: + - dotnet test .\BenchmarkDotNet.Tests\project.json --configuration Release -xml tests-results01.xml + - ps: .\build\uploadtests.ps1 "tests-results01.xml" + - dotnet test .\BenchmarkDotNet.IntegrationTests\project.json --configuration Release -xml tests-results02.xml + - ps: .\build\uploadtests.ps1 "tests-results02.xml" test: assemblies: - - BenchmarkDotNet.Tests\bin\$(configuration)\net451\win7-x64\BenchmarkDotNet.Tests.dll - - BenchmarkDotNet.IntegrationTests\bin\$(configuration)\net451\win7-x64\BenchmarkDotNet.IntegrationTests.dll - BenchmarkDotNet.IntegrationTests.Classic\bin\$(configuration)\BenchmarkDotNet.IntegrationTests.Classic.exe artifacts: diff --git a/build/uploadtests.ps1 b/build/uploadtests.ps1 new file mode 100644 index 000000000..0955ca759 --- /dev/null +++ b/build/uploadtests.ps1 @@ -0,0 +1,37 @@ +param( + [string] + $ResultsFile, + + [string] + $ResultsType = "xunit" +) + +$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" +} +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) +}