diff --git a/lib/.placeholder b/lib/.placeholder new file mode 100644 index 0000000..e69de29 diff --git a/lib/BCC-Core.0.1.5-comparable0001.nupkg b/lib/BCC-Core.0.1.5-comparable0001.nupkg new file mode 100644 index 0000000..5779e62 Binary files /dev/null and b/lib/BCC-Core.0.1.5-comparable0001.nupkg differ diff --git a/src/BCC.MSBuildLog.Tests/BCC.MSBuildLog.Tests.csproj b/src/BCC.MSBuildLog.Tests/BCC.MSBuildLog.Tests.csproj index 7f10b9e..6a4d805 100644 --- a/src/BCC.MSBuildLog.Tests/BCC.MSBuildLog.Tests.csproj +++ b/src/BCC.MSBuildLog.Tests/BCC.MSBuildLog.Tests.csproj @@ -7,14 +7,13 @@ - - - + + all runtime; build; native; contentfiles; analyzers diff --git a/src/BCC.MSBuildLog.Tests/Services/BinaryLogProcessorTests.cs b/src/BCC.MSBuildLog.Tests/Services/BinaryLogProcessorTests.cs index db0045b..257a643 100644 --- a/src/BCC.MSBuildLog.Tests/Services/BinaryLogProcessorTests.cs +++ b/src/BCC.MSBuildLog.Tests/Services/BinaryLogProcessorTests.cs @@ -42,10 +42,11 @@ public void Should_TestConsoleApp1_Warning() logData.WarningCount.Should().Be(1); logData.Annotations.Should().AllBeEquivalentTo( new Annotation( - "TestConsoleApp1/Program.cs", - CheckWarningLevel.Warning, "CS0219", - "CS0219: The variable 'hello' is assigned but its value is never used", - 13, 13) + "TestConsoleApp1/Program.cs", + 13, + 13, + CheckWarningLevel.Warning, + "CS0219: The variable 'hello' is assigned but its value is never used") ); } @@ -72,9 +73,10 @@ public void Should_TestConsoleApp1_Warning_ConfigureAs_Warning_For_Other_Code() logData.Annotations.Should().AllBeEquivalentTo( new Annotation( "TestConsoleApp1/Program.cs", - CheckWarningLevel.Warning, "CS0219", - "CS0219: The variable 'hello' is assigned but its value is never used", - 13, 13) + 13, + 13, + CheckWarningLevel.Warning, + "CS0219: The variable 'hello' is assigned but its value is never used") ); } @@ -101,9 +103,10 @@ public void Should_TestConsoleApp1_Warning_ConfigureAs_Warning() logData.Annotations.Should().AllBeEquivalentTo( new Annotation( "TestConsoleApp1/Program.cs", - CheckWarningLevel.Warning, "CS0219", - "CS0219: The variable 'hello' is assigned but its value is never used", - 13, 13) + 13, + 13, + CheckWarningLevel.Warning, + "CS0219: The variable 'hello' is assigned but its value is never used") ); } @@ -130,9 +133,10 @@ public void Should_TestConsoleApp1_Warning_ConfigureAs_Notice() logData.Annotations.Should().AllBeEquivalentTo( new Annotation( "TestConsoleApp1/Program.cs", - CheckWarningLevel.Notice, "CS0219", - "CS0219: The variable 'hello' is assigned but its value is never used", - 13, 13) + 13, + 13, + CheckWarningLevel.Notice, + "CS0219: The variable 'hello' is assigned but its value is never used") ); } @@ -159,9 +163,10 @@ public void Should_TestConsoleApp1_Warning_ConfigureAs_Error() logData.Annotations.Should().AllBeEquivalentTo( new Annotation( "TestConsoleApp1/Program.cs", - CheckWarningLevel.Failure, "CS0219", - "CS0219: The variable 'hello' is assigned but its value is never used", - 13, 13) + 13, + 13, + CheckWarningLevel.Failure, + "CS0219: The variable 'hello' is assigned but its value is never used") ); } @@ -197,9 +202,10 @@ public void Should_TestConsoleApp1_Error() logData.Annotations.Should().AllBeEquivalentTo( new Annotation( "TestConsoleApp1/Program.cs", - CheckWarningLevel.Failure, "CS1002", - "CS1002: ; expected", - 13, 13) + 13, + 13, + CheckWarningLevel.Failure, + "CS1002: ; expected") ); } @@ -215,9 +221,10 @@ public void Should_TestConsoleApp1_CodeAnalysis() logData.Annotations.Should().AllBeEquivalentTo( new Annotation( "TestConsoleApp1/Program.cs", - CheckWarningLevel.Warning, "CA2213", - "CA2213: Microsoft.Usage : 'Program.MyClass' contains field 'Program.MyClass._inner' that is of IDisposable type: 'Program.MyOTherClass'. Change the Dispose method on 'Program.MyClass' to call Dispose or Close on this field.", - 20, 20) + 20, + 20, + CheckWarningLevel.Warning, + "CA2213: Microsoft.Usage : 'Program.MyClass' contains field 'Program.MyClass._inner' that is of IDisposable type: 'Program.MyOTherClass'. Change the Dispose method on 'Program.MyClass' to call Dispose or Close on this field.") ); } @@ -234,17 +241,19 @@ public void Should_MSBLOC() logData.Annotations[0].Should().BeEquivalentTo( new Annotation( - "MSBLOC.Core.Tests/Services/BinaryLogProcessorTests.cs", - CheckWarningLevel.Warning,"CS0219", - "CS0219: The variable 'filename' is assigned but its value is never used", - 56, 56)); + "MSBLOC.Core.Tests/Services/BinaryLogProcessorTests.cs", + 56, + 56, + CheckWarningLevel.Warning, + "CS0219: The variable 'filename' is assigned but its value is never used")); logData.Annotations[1].Should().BeEquivalentTo( new Annotation( - "MSBLOC.Core.Tests/Services/BinaryLogProcessorTests.cs", - CheckWarningLevel.Warning,"CS0219", - "CS0219: The variable 'filename' is assigned but its value is never used", - 83, 83)); + "MSBLOC.Core.Tests/Services/BinaryLogProcessorTests.cs", + 83, + 83, + CheckWarningLevel.Warning, + "CS0219: The variable 'filename' is assigned but its value is never used")); } [Fact] @@ -261,16 +270,18 @@ public void Should_Parse_OctokitGraphQL() logData.Annotations[0].Should().BeEquivalentTo( new Annotation( "Octokit.GraphQL.Core/Connection.cs", - CheckWarningLevel.Warning,"CS1591", - "CS1591: Missing XML comment for publicly visible type or member 'Connection.Uri'", - 43, 43)); + 43, + 43, + CheckWarningLevel.Warning, + "CS1591: Missing XML comment for publicly visible type or member 'Connection.Uri'")); logData.Annotations[1].Should().BeEquivalentTo( new Annotation( "Octokit.GraphQL.Core/Connection.cs", - CheckWarningLevel.Warning,"CS1591", - "CS1591: Missing XML comment for publicly visible type or member 'Connection.CredentialStore'", - 44, 44)); + 44, + 44, + CheckWarningLevel.Warning, + "CS1591: Missing XML comment for publicly visible type or member 'Connection.CredentialStore'")); } [Fact] public void Should_Parse_GitHubVisualStudio() diff --git a/src/BCC.MSBuildLog.Tests/Services/BuildLogProcessorTests.cs b/src/BCC.MSBuildLog.Tests/Services/BuildLogProcessorTests.cs index 723a59f..037e349 100644 --- a/src/BCC.MSBuildLog.Tests/Services/BuildLogProcessorTests.cs +++ b/src/BCC.MSBuildLog.Tests/Services/BuildLogProcessorTests.cs @@ -43,7 +43,7 @@ public void Should_Create_Empty_CheckRun() var checkRun = GetCheckRun(CreateMockBinaryLogProcessor(annotations)); - checkRun.Success.Should().BeTrue(); + checkRun.Conclusion.Should().Be(CheckConclusion.Success); checkRun.Name.Should().Be("MSBuild Log"); checkRun.Title.Should().Be("0 Errors 0 Warnings"); checkRun.Summary.Should().Be(string.Empty); @@ -91,7 +91,7 @@ public void Should_Create_Empty_CheckRun_With_Configuration() var checkRun = GetCheckRun(CreateMockBinaryLogProcessor(annotations), configurationFile: configurationFile, mockFileSystem: mockFileSystem); - checkRun.Success.Should().BeTrue(); + checkRun.Conclusion.Should().Be(CheckConclusion.Success); checkRun.Name.Should().Be("MSBuild Log"); checkRun.Title.Should().Be("0 Errors 0 Warnings"); checkRun.Summary.Should().Be(string.Empty); @@ -105,14 +105,15 @@ public void Should_Create_CheckRun_With_Warning() { new Annotation( Faker.System.FilePath(), + Faker.Random.Int(), + Faker.Random.Int(), CheckWarningLevel.Warning, - Faker.Lorem.Word(), Faker.Lorem.Word(), - Faker.Random.Int(), Faker.Random.Int()) + Faker.Lorem.Word()) }; var checkRun = GetCheckRun(CreateMockBinaryLogProcessor(annotations)); - checkRun.Success.Should().BeTrue(); + checkRun.Conclusion.Should().Be(CheckConclusion.Success); checkRun.Name.Should().Be("MSBuild Log"); checkRun.Title.Should().Be("0 Errors 0 Warnings"); checkRun.Summary.Should().Be(string.Empty); @@ -126,9 +127,10 @@ public void Should_Create_CheckRun_With_Configuration() { new Annotation( Faker.System.FilePath(), - CheckWarningLevel.Warning, - Faker.Lorem.Word(), Faker.Lorem.Word(), - Faker.Random.Int(), Faker.Random.Int()) + Faker.Random.Int(), + Faker.Random.Int(), + CheckWarningLevel.Warning, + Faker.Lorem.Word()) }; var expectedCheckRunConfiguration = new CheckRunConfiguration @@ -155,7 +157,7 @@ public void Should_Create_CheckRun_With_Configuration() var checkRunConfiguration = mockBinaryLogProcessor.ReceivedCalls().First().GetArguments()[2] as CheckRunConfiguration; checkRunConfiguration.Should().BeEquivalentTo(expectedCheckRunConfiguration); - checkRun.Success.Should().BeTrue(); + checkRun.Conclusion.Should().Be(CheckConclusion.Success); checkRun.Name.Should().Be(expectedCheckRunConfiguration.Name); checkRun.Title.Should().Be("0 Errors 0 Warnings"); checkRun.Summary.Should().Be(string.Empty); @@ -169,14 +171,14 @@ public void Should_Create_CheckRun_With_Failure() { new Annotation( Faker.System.FilePath(), - CheckWarningLevel.Failure, - Faker.Lorem.Word(), Faker.Lorem.Word(), - Faker.Random.Int(), Faker.Random.Int()) + Faker.Random.Int(), + Faker.Random.Int(), + CheckWarningLevel.Failure, Faker.Lorem.Word()) }; var checkRun = GetCheckRun(CreateMockBinaryLogProcessor(annotations)); - checkRun.Success.Should().BeFalse(); + checkRun.Conclusion.Should().Be(CheckConclusion.Failure); checkRun.Name.Should().Be("MSBuild Log"); checkRun.Title.Should().Be("0 Errors 0 Warnings"); checkRun.Summary.Should().Be(string.Empty); @@ -190,19 +192,19 @@ public void Should_Create_CheckRun_With_WarningAndFailure() { new Annotation( Faker.System.FilePath(), - CheckWarningLevel.Warning, - Faker.Lorem.Word(), Faker.Lorem.Word(), - Faker.Random.Int(), Faker.Random.Int()), + Faker.Random.Int(), + Faker.Random.Int(), + CheckWarningLevel.Warning, Faker.Lorem.Word()), new Annotation( Faker.System.FilePath(), - CheckWarningLevel.Failure, - Faker.Lorem.Word(), Faker.Lorem.Word(), - Faker.Random.Int(), Faker.Random.Int()) + Faker.Random.Int(), + Faker.Random.Int(), + CheckWarningLevel.Failure, Faker.Lorem.Word()) }; var checkRun = GetCheckRun(CreateMockBinaryLogProcessor(annotations)); - checkRun.Success.Should().BeFalse(); + checkRun.Conclusion.Should().Be(CheckConclusion.Failure); checkRun.Name.Should().Be("MSBuild Log"); checkRun.Title.Should().Be("0 Errors 0 Warnings"); checkRun.Summary.Should().Be(string.Empty); @@ -216,9 +218,9 @@ public void Should_Create_CheckRun_TestConsoleApp1_Warning() { new Annotation( "TestConsoleApp1/Program.cs", - CheckWarningLevel.Warning, "CS0219", - "CS0219: The variable 'hello' is assigned but its value is never used", - 13, 13) + 13, + 13, + CheckWarningLevel.Warning, "CS0219: The variable 'hello' is assigned but its value is never used") }; var cloneRoot = @"C:\projects\testconsoleapp1\"; @@ -226,7 +228,7 @@ public void Should_Create_CheckRun_TestConsoleApp1_Warning() var checkRun = GetCheckRun(new BinaryLogProcessor(new BinaryLogReader(), TestLogger.Create(_testOutputHelper)), resourcePath, cloneRoot); - checkRun.Success.Should().BeTrue(); + checkRun.Conclusion.Should().Be(CheckConclusion.Success); checkRun.Name.Should().Be("MSBuild Log"); checkRun.Title.Should().Be("0 Errors 1 Warning"); checkRun.Summary.Should().Be(string.Empty); @@ -240,9 +242,9 @@ public void Should_Create_CheckRun_TestConsoleApp1_Error() { new Annotation( "TestConsoleApp1/Program.cs", - CheckWarningLevel.Failure, "CS1002", - "CS1002: ; expected", - 13, 13) + 13, + 13, + CheckWarningLevel.Failure, "CS1002: ; expected") }; var cloneRoot = @"C:\projects\testconsoleapp1\"; @@ -250,7 +252,7 @@ public void Should_Create_CheckRun_TestConsoleApp1_Error() var checkRun = GetCheckRun(new BinaryLogProcessor(new BinaryLogReader(), TestLogger.Create(_testOutputHelper)), resourcePath, cloneRoot); - checkRun.Success.Should().BeFalse(); + checkRun.Conclusion.Should().Be(CheckConclusion.Failure); checkRun.Name.Should().Be("MSBuild Log"); checkRun.Title.Should().Be("1 Error 0 Warnings"); checkRun.Summary.Should().Be(string.Empty); @@ -264,9 +266,9 @@ public void Should_Create_CheckRun_TestConsoleApp1_CodeAnalysis() { new Annotation( "TestConsoleApp1/Program.cs", - CheckWarningLevel.Warning, "CA2213", - "CA2213: Microsoft.Usage : 'Program.MyClass' contains field 'Program.MyClass._inner' that is of IDisposable type: 'Program.MyOTherClass'. Change the Dispose method on 'Program.MyClass' to call Dispose or Close on this field.", - 20, 20) + 20, + 20, + CheckWarningLevel.Warning, "CA2213: Microsoft.Usage : 'Program.MyClass' contains field 'Program.MyClass._inner' that is of IDisposable type: 'Program.MyOTherClass'. Change the Dispose method on 'Program.MyClass' to call Dispose or Close on this field.") }; var cloneRoot = @"C:\projects\testconsoleapp1\"; @@ -274,7 +276,7 @@ public void Should_Create_CheckRun_TestConsoleApp1_CodeAnalysis() var checkRun = GetCheckRun(new BinaryLogProcessor(new BinaryLogReader(), TestLogger.Create(_testOutputHelper)), resourcePath, cloneRoot); - checkRun.Success.Should().BeTrue(); + checkRun.Conclusion.Should().Be(CheckConclusion.Success); checkRun.Name.Should().Be("MSBuild Log"); checkRun.Title.Should().Be("0 Errors 1 Warning"); checkRun.Summary.Should().Be(string.Empty); diff --git a/src/BCC.MSBuildLog.sln b/src/BCC.MSBuildLog.sln index b4185ac..e65c4a9 100644 --- a/src/BCC.MSBuildLog.sln +++ b/src/BCC.MSBuildLog.sln @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{FFB46A17 ..\Build.fsx = ..\Build.fsx ..\codecov.yml = ..\codecov.yml ..\GitVersion.yml = ..\GitVersion.yml + nuget.config = nuget.config ..\nuget\Package.nuspec = ..\nuget\Package.nuspec ..\paket.dependencies = ..\paket.dependencies EndProjectSection diff --git a/src/BCC.MSBuildLog/BCC.MSBuildLog.csproj b/src/BCC.MSBuildLog/BCC.MSBuildLog.csproj index 239a94b..cf8c770 100644 --- a/src/BCC.MSBuildLog/BCC.MSBuildLog.csproj +++ b/src/BCC.MSBuildLog/BCC.MSBuildLog.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/BCC.MSBuildLog/Model/LogData.cs b/src/BCC.MSBuildLog/Model/LogData.cs new file mode 100644 index 0000000..8c4c651 --- /dev/null +++ b/src/BCC.MSBuildLog/Model/LogData.cs @@ -0,0 +1,11 @@ +using BCC.Core.Model.CheckRunSubmission; + +namespace BCC.MSBuildLog.Model +{ + public class LogData + { + public int WarningCount { get; set; } + public int ErrorCount { get; set; } + public Annotation[] Annotations { get; set; } + } +} \ No newline at end of file diff --git a/src/BCC.MSBuildLog/Services/BinaryLogProcessor.cs b/src/BCC.MSBuildLog/Services/BinaryLogProcessor.cs index 1e6febf..951f99f 100644 --- a/src/BCC.MSBuildLog/Services/BinaryLogProcessor.cs +++ b/src/BCC.MSBuildLog/Services/BinaryLogProcessor.cs @@ -175,10 +175,9 @@ private Annotation CreateAnnotation(CheckWarningLevel checkWarningLevel, [NotNul var relativePath = GetRelativePath(filePath, cloneRoot).Replace("\\", "/"); - return new Annotation(relativePath, checkWarningLevel, - title, message, - lineNumber, - endLineNumber == 0 ? lineNumber : endLineNumber); + return new Annotation(relativePath, lineNumber, + endLineNumber == 0 ? lineNumber : endLineNumber, checkWarningLevel, + message); } private string GetRelativePath(string filespec, string folder) diff --git a/src/BCC.MSBuildLog/Services/BuildLogProcessor.cs b/src/BCC.MSBuildLog/Services/BuildLogProcessor.cs index 5ca34f5..2010b5d 100644 --- a/src/BCC.MSBuildLog/Services/BuildLogProcessor.cs +++ b/src/BCC.MSBuildLog/Services/BuildLogProcessor.cs @@ -77,7 +77,7 @@ public void Proces(string inputFile, string outputFile, string cloneRoot, string var contents = JsonConvert.SerializeObject(new CreateCheckRun { Annotations = logData.Annotations, - Success = !hasAnyFailure, + Conclusion = !hasAnyFailure ? CheckConclusion.Success : CheckConclusion.Failure, StartedAt = dateTimeOffset, CompletedAt = DateTimeOffset.Now, Summary = string.Empty, diff --git a/src/nuget.config b/src/nuget.config new file mode 100644 index 0000000..a368bba --- /dev/null +++ b/src/nuget.config @@ -0,0 +1,7 @@ + + + + + + +