From 1371d7736c125bd5399daf4fe2e6e9c1e0ae13a7 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Thu, 9 Jun 2022 16:18:31 -0500 Subject: [PATCH] add GithubActionsTestLogger and use it in CI builds --- build.fsx | 14 ++++++++++++-- paket.dependencies | 1 + paket.lock | 2 ++ .../FSharp.Data.DesignTime.Tests/paket.references | 2 +- tests/FSharp.Data.Reference.Tests/paket.references | 3 ++- tests/FSharp.Data.Tests.CSharp/paket.references | 3 ++- tests/FSharp.Data.Tests/paket.references | 3 ++- 7 files changed, 22 insertions(+), 6 deletions(-) diff --git a/build.fsx b/build.fsx index 00ccddca4..0eead60f0 100644 --- a/build.fsx +++ b/build.fsx @@ -55,6 +55,8 @@ let license = "Apache-2.0" // Read release notes & version info from RELEASE_NOTES.md let release = ReleaseNotes.load "RELEASE_NOTES.md" +let isCI = Environment.GetEnvironmentVariable("CI") <> null + // -------------------------------------------------------------------------------------- // Generate assembly info files with the right version & up-to-date information @@ -106,8 +108,16 @@ Target.create "Build" (fun _ -> |> DotNet.build (fun o -> { o with Configuration = DotNet.BuildConfiguration.Release })) Target.create "RunTests" (fun _ -> - "FSharp.Data.sln" - |> DotNet.test (fun o -> { o with Configuration = DotNet.BuildConfiguration.Release })) + let setParams (o: DotNet.TestOptions) = + { o with + Configuration = DotNet.BuildConfiguration.Release + Logger = + if isCI then + Some "GitHubActions" + else + None } + + "FSharp.Data.sln" |> DotNet.test setParams) // -------------------------------------------------------------------------------------- // Build a NuGet package diff --git a/paket.dependencies b/paket.dependencies index d411c0899..f5d6e4b84 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -55,3 +55,4 @@ group Test nuget NUnit3TestAdapter nuget FsUnit 4.0.4 nuget FsCheck 2.15.1 + nuget GitHubActionsTestLogger diff --git a/paket.lock b/paket.lock index 74aa61290..57aec27ed 100644 --- a/paket.lock +++ b/paket.lock @@ -345,6 +345,8 @@ NUGET FSharp.Core (>= 4.3.4) NETStandard.Library (>= 2.0.3) NUnit (>= 3.13 < 4.0) + GitHubActionsTestLogger (2.0) + Microsoft.TestPlatform.ObjectModel (>= 17.2) Microsoft.CodeCoverage (17.2) Microsoft.NET.Test.Sdk (17.2) Microsoft.CodeCoverage (>= 17.2) diff --git a/tests/FSharp.Data.DesignTime.Tests/paket.references b/tests/FSharp.Data.DesignTime.Tests/paket.references index 16064003a..c17b40ce3 100644 --- a/tests/FSharp.Data.DesignTime.Tests/paket.references +++ b/tests/FSharp.Data.DesignTime.Tests/paket.references @@ -4,4 +4,4 @@ group Test NUnit NUnit3TestAdapter FsUnit - \ No newline at end of file + GitHubActionsTestLogger diff --git a/tests/FSharp.Data.Reference.Tests/paket.references b/tests/FSharp.Data.Reference.Tests/paket.references index b9f34b9a4..aaa9d970b 100644 --- a/tests/FSharp.Data.Reference.Tests/paket.references +++ b/tests/FSharp.Data.Reference.Tests/paket.references @@ -4,4 +4,5 @@ group Test NUnit NUnit3TestAdapter FsUnit - FsCheck \ No newline at end of file + FsCheck + GitHubActionsTestLogger diff --git a/tests/FSharp.Data.Tests.CSharp/paket.references b/tests/FSharp.Data.Tests.CSharp/paket.references index 4a37a63b9..7ed61c8d3 100644 --- a/tests/FSharp.Data.Tests.CSharp/paket.references +++ b/tests/FSharp.Data.Tests.CSharp/paket.references @@ -2,4 +2,5 @@ group Test Microsoft.NET.Test.Sdk NUnit - NUnit3TestAdapter \ No newline at end of file + NUnit3TestAdapter + GitHubActionsTestLogger diff --git a/tests/FSharp.Data.Tests/paket.references b/tests/FSharp.Data.Tests/paket.references index b9f34b9a4..aaa9d970b 100644 --- a/tests/FSharp.Data.Tests/paket.references +++ b/tests/FSharp.Data.Tests/paket.references @@ -4,4 +4,5 @@ group Test NUnit NUnit3TestAdapter FsUnit - FsCheck \ No newline at end of file + FsCheck + GitHubActionsTestLogger