From b40c79865a77925ece20c4d288c774312e8bdb1b Mon Sep 17 00:00:00 2001 From: Zachary Danz Date: Thu, 28 Feb 2019 15:37:48 -0800 Subject: [PATCH 1/8] include coverlet.msbuild 2.5.1 --- .../System.Windows.Forms.Design.Editors.Tests.csproj | 4 +++- .../tests/System.Windows.Forms.Design.Tests.csproj | 6 ++++++ .../System.Windows.Forms.IntegrationTests.csproj | 1 + .../tests/UnitTests/System.Windows.Forms.Tests.csproj | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/System.Windows.Forms.Design.Editors/tests/UnitTests/System.Windows.Forms.Design.Editors.Tests.csproj b/src/System.Windows.Forms.Design.Editors/tests/UnitTests/System.Windows.Forms.Design.Editors.Tests.csproj index 66182c1e0eb..4c8b98d09ce 100644 --- a/src/System.Windows.Forms.Design.Editors/tests/UnitTests/System.Windows.Forms.Design.Editors.Tests.csproj +++ b/src/System.Windows.Forms.Design.Editors/tests/UnitTests/System.Windows.Forms.Design.Editors.Tests.csproj @@ -5,8 +5,10 @@ System.Windows.Forms.Design.Editors.Tests - + + + diff --git a/src/System.Windows.Forms.Design/tests/System.Windows.Forms.Design.Tests.csproj b/src/System.Windows.Forms.Design/tests/System.Windows.Forms.Design.Tests.csproj index 59a07a863ae..fc80638d76f 100644 --- a/src/System.Windows.Forms.Design/tests/System.Windows.Forms.Design.Tests.csproj +++ b/src/System.Windows.Forms.Design/tests/System.Windows.Forms.Design.Tests.csproj @@ -6,6 +6,12 @@ 7.3 + + + + + + diff --git a/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests/System.Windows.Forms.IntegrationTests.csproj b/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests/System.Windows.Forms.IntegrationTests.csproj index 66a0132e833..6aefc3aa880 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests/System.Windows.Forms.IntegrationTests.csproj +++ b/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests/System.Windows.Forms.IntegrationTests.csproj @@ -9,6 +9,7 @@ + diff --git a/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj b/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj index 91b28c24f6a..6e4717b22cf 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj +++ b/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj @@ -9,6 +9,7 @@ + From 4de3fd26f8ed2fe8dbdc0807627402ecd5675db4 Mon Sep 17 00:00:00 2001 From: Zachary Danz Date: Thu, 28 Feb 2019 15:49:58 -0800 Subject: [PATCH 2/8] add targets and coverage group --- Directory.Build.props | 13 +++++++++++++ Directory.Build.targets | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Directory.Build.props b/Directory.Build.props index 400b1b90c40..fbf50b3c0c7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -20,4 +20,17 @@ Full + + + true + true + opencover + $(BaseOutputPath)$(PlatformConfig)\coverage\$(MSBuildProjectName).coverage + [System.Windows.Forms]* + + + Obsolete,ExcludeFromCodeCoverage + + + diff --git a/Directory.Build.targets b/Directory.Build.targets index bc9b533266b..b2d7341a13a 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -7,5 +7,19 @@ + + + + + + <_CoverletOriginalTargetPath>$(TargetPath) + $([System.IO.Path]::GetDirectoryName($(TargetPath)))\NonExistent.dll + + + + + $(_CoverletOriginalTargetPath) + + From 562722b470a6f79a9b3f813c742ffe70edace7d3 Mon Sep 17 00:00:00 2001 From: Zachary Danz Date: Thu, 7 Mar 2019 16:06:30 -0800 Subject: [PATCH 3/8] mock dotnet/machinelearning#2843 --- Directory.Build.props | 1 + Directory.Build.targets | 17 +---------------- eng/Versions.props | 1 + ...em.Windows.Forms.Design.Editors.Tests.csproj | 2 +- .../System.Windows.Forms.Design.Tests.csproj | 2 +- ...System.Windows.Forms.IntegrationTests.csproj | 2 +- .../UnitTests/System.Windows.Forms.Tests.csproj | 2 +- 7 files changed, 7 insertions(+), 20 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index fbf50b3c0c7..6d253105915 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -23,6 +23,7 @@ true + true true opencover $(BaseOutputPath)$(PlatformConfig)\coverage\$(MSBuildProjectName).coverage diff --git a/Directory.Build.targets b/Directory.Build.targets index b2d7341a13a..678db37cd18 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -7,19 +7,4 @@ - - - - - - <_CoverletOriginalTargetPath>$(TargetPath) - $([System.IO.Path]::GetDirectoryName($(TargetPath)))\NonExistent.dll - - - - - $(_CoverletOriginalTargetPath) - - - - + \ No newline at end of file diff --git a/eng/Versions.props b/eng/Versions.props index 9a820c5c694..ea57510dbf5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -30,5 +30,6 @@ 0.3.5 4.10.0 1.0.0 + 2.6.0 diff --git a/src/System.Windows.Forms.Design.Editors/tests/UnitTests/System.Windows.Forms.Design.Editors.Tests.csproj b/src/System.Windows.Forms.Design.Editors/tests/UnitTests/System.Windows.Forms.Design.Editors.Tests.csproj index 4c8b98d09ce..cb17950dd63 100644 --- a/src/System.Windows.Forms.Design.Editors/tests/UnitTests/System.Windows.Forms.Design.Editors.Tests.csproj +++ b/src/System.Windows.Forms.Design.Editors/tests/UnitTests/System.Windows.Forms.Design.Editors.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/System.Windows.Forms.Design/tests/System.Windows.Forms.Design.Tests.csproj b/src/System.Windows.Forms.Design/tests/System.Windows.Forms.Design.Tests.csproj index fc80638d76f..534d4377928 100644 --- a/src/System.Windows.Forms.Design/tests/System.Windows.Forms.Design.Tests.csproj +++ b/src/System.Windows.Forms.Design/tests/System.Windows.Forms.Design.Tests.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests/System.Windows.Forms.IntegrationTests.csproj b/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests/System.Windows.Forms.IntegrationTests.csproj index 6aefc3aa880..b193a00d6ee 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests/System.Windows.Forms.IntegrationTests.csproj +++ b/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests/System.Windows.Forms.IntegrationTests.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj b/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj index 6e4717b22cf..f8cbe2f2050 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj +++ b/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj @@ -9,7 +9,7 @@ - + From 2b214bc806697c4cbf7d62f3333a5ef0da5588e7 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 7 Mar 2019 18:20:18 -0600 Subject: [PATCH 4/8] Hook coverlet up to the 'RunTests' target --- Directory.Build.props | 4 ++++ Directory.Build.targets | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/Directory.Build.props b/Directory.Build.props index 6d253105915..8bdacd2ef98 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -34,4 +34,8 @@ + + + + diff --git a/Directory.Build.targets b/Directory.Build.targets index 678db37cd18..ea28dfee5f3 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -7,4 +7,13 @@ + + + + + + + + + \ No newline at end of file From c84a592138eb5d67a3ba277df92fb362daa4e6f5 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 7 Mar 2019 21:47:42 -0600 Subject: [PATCH 5/8] Upload data to codecov.io --- Directory.Build.props | 18 ++++++------- Directory.Build.targets | 5 ++++ codecov.yml | 34 ++++++++++++++++++++++++ eng/CodeCoverage.proj | 54 ++++++++++++++++++++++++++++++++++++++ eng/FacadeAssemblies.props | 3 +++ eng/Versions.props | 2 ++ eng/ci.yml | 14 ++++++++++ 7 files changed, 121 insertions(+), 9 deletions(-) create mode 100644 codecov.yml create mode 100644 eng/CodeCoverage.proj diff --git a/Directory.Build.props b/Directory.Build.props index 8bdacd2ef98..b41fb2bebcc 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -14,20 +14,20 @@ MIT - - - - Full - - + + portable + + false + + + true - true + true true opencover - $(BaseOutputPath)$(PlatformConfig)\coverage\$(MSBuildProjectName).coverage - [System.Windows.Forms]* + [System.Windows.*]* Obsolete,ExcludeFromCodeCoverage diff --git a/Directory.Build.targets b/Directory.Build.targets index ea28dfee5f3..9e901b0251c 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -8,6 +8,11 @@ + + + $(TargetDir)coverage\$(MSBuildProjectName).coverage + + diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000000..de20aaa596c --- /dev/null +++ b/codecov.yml @@ -0,0 +1,34 @@ +# https://docs.codecov.io/docs/codecov-yaml +# https://github.com/codecov/support/wiki/Codecov-Yaml + +coverage: + status: + project: + default: false + patch: + default: false + fixes: + - "eng/::/" + +comment: + layout: "diff, flags" + +flags: + production: + paths: + - src/Common/src/ + - src/System.Design/src/ + - src/System.Drawing/src/ + - src/System.Drawing.Design/src/ + - src/System.Windows.Forms/src/ + - src/System.Windows.Forms.Design/src/ + - src/System.Windows.Forms.Design.Editors/src/ + test: + paths: + - src/Common/tests/ + - src/System.Design/tests/ + - src/System.Drawing/tests/ + - src/System.Drawing.Design/tests/ + - src/System.Windows.Forms/tests/ + - src/System.Windows.Forms.Design/tests/ + - src/System.Windows.Forms.Design.Editors/tests/ diff --git a/eng/CodeCoverage.proj b/eng/CodeCoverage.proj new file mode 100644 index 00000000000..fdd24ac39a8 --- /dev/null +++ b/eng/CodeCoverage.proj @@ -0,0 +1,54 @@ + + + + + netcoreapp3.0 + + + + + + + + + <_CodecovPath>$(NuGetPackageRoot)codecov\$(CodecovVersion)\tools\Codecov.exe + <_ReportGeneratorPath>$(NuGetPackageRoot)reportgenerator\$(ReportGeneratorVersion)\tools\net47\ReportGenerator.exe + <_BranchName Condition="'$(_BranchName)' == ''">$(SYSTEM_PULLREQUEST_SOURCEBRANCH) + <_BranchName Condition="'$(_BranchName)' == ''">$(BUILD_SOURCEBRANCHNAME) + + + + + <_CoverageReports Include="$(ArtifactsBinDir)*\$(Configuration)\*\coverage\*.coverage" /> + + + + + + + <_CodecovArgs Include="-f;$(BaseOutputPath)coverage\Cobertura.xml" /> + <_CodecovArgs Include="-r;$(BUILD_REPOSITORY_NAME)" Condition="'$(BUILD_REPOSITORY_NAME)' != ''" /> + <_CodecovArgs Include="--pr;$(SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)" Condition="'$(SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)' != ''" /> + <_CodecovArgs Include="-b;$(BUILD_BUILDNUMBER)" Condition="'$(BUILD_BUILDNUMBER)' != ''" /> + <_CodecovArgs Include="--branch;$(_BranchName)" Condition="'$(_BranchName)' != ''" /> + <_CodecovArgs Include="-c;$(BUILD_SOURCEVERSION)" Condition="'$(BUILD_SOURCEVERSION)' != ''" /> + <_CodecovArgs Include="-n;$(BUILD_DEFINITIONNAME)" Condition="'$(BUILD_DEFINITIONNAME)' != ''" /> + <_CodecovArgs Include="-t;$(CodeCovToken)" Condition="'$(CodeCovToken)' != ''" /> + + <_CodecovFlags Include="$(Configuration)" Condition="'$(Configuration)' != ''" /> + <_CodecovProductionFlags Include="@(_CodecovFlags)" /> + <_CodecovProductionFlags Include="production" /> + <_CodecovTestFlags Include="@(_CodecovFlags)" /> + <_CodecovTestFlags Include="test" /> + + + + + + + + + + + + diff --git a/eng/FacadeAssemblies.props b/eng/FacadeAssemblies.props index e5a199c1fcd..452d4884d96 100644 --- a/eng/FacadeAssemblies.props +++ b/eng/FacadeAssemblies.props @@ -9,6 +9,9 @@ true true + + full + net472 $(NoWarn);NU1701 diff --git a/eng/Versions.props b/eng/Versions.props index 06c93e81200..293521e31dd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -31,5 +31,7 @@ 4.10.0 1.0.0 2.6.0 + 1.1.1 + 4.0.9 diff --git a/eng/ci.yml b/eng/ci.yml index f6516209841..c6e61ed5852 100644 --- a/eng/ci.yml +++ b/eng/ci.yml @@ -93,8 +93,10 @@ jobs: _PublishType: none _SignType: test _DotNetPublishToBlobFeed : false + _Coverage: true Build_Release: _BuildConfig: Release + _Coverage: false steps: - checkout: self @@ -106,6 +108,7 @@ jobs: -configuration $(_BuildConfig) $(_OfficialBuildIdArgs) -build + /p:Coverage=$(_Coverage) /bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\Build.binlog displayName: Build @@ -115,6 +118,8 @@ jobs: $(_OfficialBuildIdArgs) -test /bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\Test.binlog + /p:Coverage=$(_Coverage) + /m:1 displayName: Run Unit Tests # Run integration tests and rename binlog @@ -125,6 +130,15 @@ jobs: /bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\IntegrationTest.binlog displayName: Run Integration Tests + # Upload code coverage data + - script: $(Build.SourcesDirectory)/.dotnet/dotnet msbuild + eng/CodeCoverage.proj + /p:Configuration=$(_BuildConfig) + /p:CodeCovToken=$(CODECOV_TOKEN) + /bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\CodeCoverage.binlog + displayName: Upload coverage to codecov.io + condition: and(succeeded(), eq(variables._Coverage, 'true')) + # Create Nuget package, sign, and publish; and rename binlog - script: eng\cibuild.cmd -configuration $(_BuildConfig) From 97b036478a5fdb5491c8bfc26bf922409989521d Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Fri, 8 Mar 2019 09:52:01 -0600 Subject: [PATCH 6/8] Add code coverage badge to the README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ec2b9f6cd06..e23435ac7b1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Windows Forms -[![Build Status](https://dnceng.visualstudio.com/public/_apis/build/status/dotnet/winforms/dotnet-winforms%20CI)](https://dnceng.visualstudio.com/public/_build/latest?definitionId=267&branch=master) +[![Build Status](https://dnceng.visualstudio.com/public/_apis/build/status/dotnet/winforms/dotnet-winforms%20CI)](https://dnceng.visualstudio.com/public/_build/latest?definitionId=267&branch=master) +[![codecov](https://codecov.io/gh/dotnet/winforms/branch/master/graph/badge.svg?flag=production)](https://codecov.io/gh/dotnet/winforms) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/dotnet/winforms/blob/master/LICENSE.TXT) Windows Forms (WinForms) is a UI framework for building Windows desktop applications. It is a .NET wrapper over Windows user interface libraries, such as User32 and GDI+. It also offers controls and other functionality that is unique to Windows Forms. From 3133d132232ceb8c494d588d1ebd4a652d3a6e19 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 14 Mar 2019 06:34:10 -0500 Subject: [PATCH 7/8] Add clarifying comments for code coverage configuration --- eng/CodeCoverage.proj | 7 +++++++ eng/Versions.props | 9 ++++++--- eng/ci.yml | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/eng/CodeCoverage.proj b/eng/CodeCoverage.proj index fdd24ac39a8..7b2df18f60a 100644 --- a/eng/CodeCoverage.proj +++ b/eng/CodeCoverage.proj @@ -13,6 +13,9 @@ <_CodecovPath>$(NuGetPackageRoot)codecov\$(CodecovVersion)\tools\Codecov.exe <_ReportGeneratorPath>$(NuGetPackageRoot)reportgenerator\$(ReportGeneratorVersion)\tools\net47\ReportGenerator.exe + + <_BranchName Condition="'$(_BranchName)' == ''">$(SYSTEM_PULLREQUEST_SOURCEBRANCH) <_BranchName Condition="'$(_BranchName)' == ''">$(BUILD_SOURCEBRANCHNAME) @@ -22,10 +25,14 @@ <_CoverageReports Include="$(ArtifactsBinDir)*\$(Configuration)\*\coverage\*.coverage" /> + + <_CodecovArgs Include="-f;$(BaseOutputPath)coverage\Cobertura.xml" /> <_CodecovArgs Include="-r;$(BUILD_REPOSITORY_NAME)" Condition="'$(BUILD_REPOSITORY_NAME)' != ''" /> <_CodecovArgs Include="--pr;$(SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)" Condition="'$(SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)' != ''" /> diff --git a/eng/Versions.props b/eng/Versions.props index d3d42235b72..7450a9c0441 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -33,13 +33,16 @@ $(XUnitVersion) 0.3.5 + + + 2.6.0 + 1.1.1 + 4.0.9 + 4.6.0-alpha-27122-5 4.10.0 1.0.0 - 2.6.0 - 1.1.1 - 4.0.9 diff --git a/eng/ci.yml b/eng/ci.yml index 3fa1b609364..199cedcfae8 100644 --- a/eng/ci.yml +++ b/eng/ci.yml @@ -123,6 +123,9 @@ jobs: displayName: Pre-Build - Set VSO Variables # Build and rename binlog + # Note: The /p:Coverage argument is passed here since some build properties change to accommodate running with + # coverage. This is part of the workarounds for https://github.com/tonerdo/coverlet/issues/362 and + # https://github.com/tonerdo/coverlet/issues/363. - script: eng\cibuild.cmd -prepareMachine -configuration $(_BuildConfig) @@ -134,6 +137,7 @@ jobs: # Run Unit Tests # this should no longer be necessary once Helix is ready to report back code coverage + # Tests are run with /m:1 to work around https://github.com/tonerdo/coverlet/issues/364 - script: eng\cibuild.cmd -prepareMachine -configuration $(_BuildConfig) From 22488658a85bf0794a43270652a5e744303449f0 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 14 Mar 2019 16:59:03 -0500 Subject: [PATCH 8/8] Move coverage upload after pick/sign/publish --- eng/ci.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/eng/ci.yml b/eng/ci.yml index 199cedcfae8..26f4c196430 100644 --- a/eng/ci.yml +++ b/eng/ci.yml @@ -171,15 +171,6 @@ jobs: /bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\IntegrationTest.binlog displayName: Run Integration Tests on Build Machine - # Upload code coverage data - - script: $(Build.SourcesDirectory)/.dotnet/dotnet msbuild - eng/CodeCoverage.proj - /p:Configuration=$(_BuildConfig) - /p:CodeCovToken=$(CODECOV_TOKEN) - /bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\CodeCoverage.binlog - displayName: Upload coverage to codecov.io - condition: and(succeeded(), eq(variables._Coverage, 'true')) - # Create Nuget package, sign, and publish; and rename binlog - script: eng\cibuild.cmd -configuration $(_BuildConfig) @@ -190,6 +181,15 @@ jobs: /bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\PackSignPublish.binlog displayName: Pack, Sign, and Publish + # Upload code coverage data + - script: $(Build.SourcesDirectory)/.dotnet/dotnet msbuild + eng/CodeCoverage.proj + /p:Configuration=$(_BuildConfig) + /p:CodeCovToken=$(CODECOV_TOKEN) + /bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\CodeCoverage.binlog + displayName: Upload coverage to codecov.io + condition: and(succeeded(), eq(variables._Coverage, 'true')) + # Perform some internal-build-only tasks - ${{ if eq(parameters.runAsPublic, 'false') }}: