From 7f8d9320078adaca313d9dbfd8a0279f0d7c05f3 Mon Sep 17 00:00:00 2001 From: Julien Roncaglia Date: Sun, 14 Feb 2016 16:21:03 +0100 Subject: [PATCH 1/3] Add missing test result formats to AppVeyor --- src/app/FakeLib/AppVeyor.fs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/FakeLib/AppVeyor.fs b/src/app/FakeLib/AppVeyor.fs index ab4e6e2db0d..b4206b98b9c 100644 --- a/src/app/FakeLib/AppVeyor.fs +++ b/src/app/FakeLib/AppVeyor.fs @@ -152,8 +152,10 @@ let FinishTestCase testSuiteName testCaseName (duration : System.TimeSpan) = /// Union type representing the available test result formats accepted by AppVeyor. type TestResultsType = | MsTest - | NUnit | Xunit + | NUnit + | NUnit3 + | JUnit /// Uploads all the test results ".xml" files in a directory to make them visible in Test tab of the build console. let UploadTestResultsXml (testResultsType : TestResultsType) outputDir = From 0a58b45353c53823dbf50cccb3e9b6d630f77307 Mon Sep 17 00:00:00 2001 From: Julien Roncaglia Date: Sun, 14 Feb 2016 16:21:24 +0100 Subject: [PATCH 2/3] Add a function to send a single file to AppVeyor --- src/app/FakeLib/AppVeyor.fs | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/app/FakeLib/AppVeyor.fs b/src/app/FakeLib/AppVeyor.fs index b4206b98b9c..68fb69c1722 100644 --- a/src/app/FakeLib/AppVeyor.fs +++ b/src/app/FakeLib/AppVeyor.fs @@ -157,18 +157,23 @@ type TestResultsType = | NUnit3 | JUnit -/// Uploads all the test results ".xml" files in a directory to make them visible in Test tab of the build console. -let UploadTestResultsXml (testResultsType : TestResultsType) outputDir = +/// Uploads a test result file to make them visible in Test tab of the build console. +let UploadTestResultsFile (testResultsType : TestResultsType) file = if buildServer = BuildServer.AppVeyor then let resultsType = (sprintf "%A" testResultsType).ToLower() let url = sprintf "https://ci.appveyor.com/api/testresults/%s/%s" resultsType AppVeyorEnvironment.JobId - let files = System.IO.Directory.GetFiles(path = outputDir, searchPattern = "*.xml") use wc = new System.Net.WebClient() - files - |> Seq.iter (fun file -> - try - wc.UploadFile(url, file) |> ignore - printfn "Successfully uploaded test results %s" file - with - | ex -> printfn "An error occurred while uploading %s:\r\n%O" file ex - ) + try + wc.UploadFile(url, file) |> ignore + printfn "Successfully uploaded test results %s" file + with + | ex -> printfn "An error occurred while uploading %s:\r\n%O" file ex + +/// Uploads all the test results ".xml" files in a directory to make them visible in Test tab of the build console. +let UploadTestResultsXml (testResultsType : TestResultsType) outputDir = + if buildServer = BuildServer.AppVeyor then + System.IO.Directory.EnumerateFiles(path = outputDir, searchPattern = "*.xml") + |> Seq.map(fun file -> async { UploadTestResultsFile testResultsType file }) + |> Async.Parallel + |> Async.RunSynchronously + |> ignore \ No newline at end of file From 640281b64c0282b4171a309289a3536f8ac3ffad Mon Sep 17 00:00:00 2001 From: Julien Roncaglia Date: Sun, 14 Feb 2016 16:24:15 +0100 Subject: [PATCH 3/3] Newline at end of file --- src/app/FakeLib/AppVeyor.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/FakeLib/AppVeyor.fs b/src/app/FakeLib/AppVeyor.fs index 68fb69c1722..851d2993335 100644 --- a/src/app/FakeLib/AppVeyor.fs +++ b/src/app/FakeLib/AppVeyor.fs @@ -176,4 +176,4 @@ let UploadTestResultsXml (testResultsType : TestResultsType) outputDir = |> Seq.map(fun file -> async { UploadTestResultsFile testResultsType file }) |> Async.Parallel |> Async.RunSynchronously - |> ignore \ No newline at end of file + |> ignore