Skip to content

Code coverage support #2116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 55 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
3e58f16
Add coverlet to generate code coverage files for test projects.
codemzs Jan 10, 2019
4abf24f
build fix.
codemzs Jan 11, 2019
c9e1c48
PR feedback.
codemzs Jan 11, 2019
ff53ec2
build fix.
codemzs Jan 11, 2019
b982a4d
build fix.
codemzs Jan 11, 2019
687754b
build fix.
codemzs Jan 11, 2019
cd0146d
build fix.
codemzs Jan 11, 2019
a1b92b2
build fix.
codemzs Jan 11, 2019
ebd2daa
build fix.
codemzs Jan 11, 2019
c7de1d1
build fix.
codemzs Jan 11, 2019
b8fa15c
build fix.
codemzs Jan 11, 2019
648edbf
build fix.
codemzs Jan 11, 2019
8b016ad
pr feedback
codemzs Jan 11, 2019
622690f
PR feedback.
codemzs Jan 11, 2019
9b30a23
Merge branch 'master' of https://github.com/dotnet/machinelearning in…
codemzs Jan 12, 2019
c45b4cb
move coverlet to a stable version that doesn't contain bug.
codemzs Jan 12, 2019
2bdafa9
PR feedback.
codemzs Jan 12, 2019
3040ede
fix.
codemzs Jan 12, 2019
3ffe203
fix.
codemzs Jan 12, 2019
dfdb963
fix.
codemzs Jan 12, 2019
84c9f6f
fix.
codemzs Jan 12, 2019
c781aaf
update coverlet nuget version to get the latest and greatest.
codemzs Jan 17, 2019
6761913
Merge branch 'master' of https://github.com/dotnet/machinelearning in…
codemzs Jan 17, 2019
d21d981
increase build timeout to get clean builds.
codemzs Jan 17, 2019
b57f108
exclude coverage from hot and trivial code paths to improve perf and …
codemzs Jan 17, 2019
741a517
exclude utils classes from CC to measure pref improvements.
codemzs Jan 18, 2019
355b8a4
limit code coverage to just win x64 debug.
codemzs Jan 18, 2019
fb79ea7
Merge branch 'master' of https://github.com/dotnet/machinelearning in…
codemzs Jan 18, 2019
aebd038
add code cov.
codemzs Jan 18, 2019
8f53889
add code cov.
codemzs Jan 18, 2019
24ad24a
add code cov.
codemzs Jan 18, 2019
8a52e13
build break.
codemzs Jan 18, 2019
03cb6d5
build break.
codemzs Jan 18, 2019
d6db6ff
build break.
codemzs Jan 18, 2019
8498f05
build break.
codemzs Jan 18, 2019
662c4d9
build break.
codemzs Jan 18, 2019
ec6c476
build break.
codemzs Jan 18, 2019
8508b3b
build break.
codemzs Jan 18, 2019
95831d2
fix codecov args.
codemzs Jan 18, 2019
229f0e1
fix codecov args.
codemzs Jan 18, 2019
d250b1a
fix codecov args.
codemzs Jan 18, 2019
4a3d686
Enable uploading of code coverage reports to codecov.
codemzs Jan 18, 2019
717d207
Enable uploading of code coverage reports to codecov.
codemzs Jan 18, 2019
ceb4a45
Enable uploading of code coverage reports to codecov.
codemzs Jan 18, 2019
4c0cf5a
Enable uploading of code coverage reports to codecov.
codemzs Jan 19, 2019
5a107ae
Merge branch 'master' of https://github.com/dotnet/machinelearning in…
codemzs Jan 19, 2019
e485094
Add option for code coverage.
codemzs Jan 19, 2019
455bceb
Add option for code coverage.
codemzs Jan 19, 2019
0f1f293
cleanup.
codemzs Jan 20, 2019
feee804
clean up.
codemzs Jan 20, 2019
661793f
clean up.
codemzs Jan 20, 2019
f9fea94
cleanup.
codemzs Jan 20, 2019
1e216c3
cleanup.
codemzs Jan 20, 2019
8f985db
cleanup.
codemzs Jan 20, 2019
93f2955
clean up.
codemzs Jan 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Daily NuGet builds of the project are also available in our [MyGet](https://dotn

To build ML.NET from source please visit our [developers guide](docs/project-docs/developer-guide.md).

[![codecov](https://codecov.io/gh/dotnet/machinelearning/branch/master/graph/badge.svg)](https://codecov.io/gh/dotnet/machinelearning)

| | Debug | Release |
|:---|----------------:|------------------:|
|**Linux**|[![x64-debug](https://dnceng.visualstudio.com/public/_apis/build/status/dotnet/machinelearning/MachineLearning-CI?branchName=master&jobname=Linux&configuration=Build_Debug)](https://dnceng.visualstudio.com/DotNet-Public/_build/latest?definitionId=104&branch=master)|[![x64-release](https://dnceng.visualstudio.com/public/_apis/build/status/dotnet/machinelearning/MachineLearning-CI?branchName=master&jobname=Linux&configuration=Build_Release)](https://dnceng.visualstudio.com/DotNet-Public/_build/latest?definitionId=104&branch=master)|
Expand Down
32 changes: 32 additions & 0 deletions build/Codecov.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="..\Directory.Build.props" />

<Target Name="Codecov">
<PropertyGroup Condition="'$(UseCodecov)' == 'true'">
<_CodecovPath>$(RestorePackagesPath)codecov\$(CodecovVersion)\tools\Codecov.exe</_CodecovPath>

<_BranchName Condition="'$(_BranchName)' == ''">$(SYSTEM_PULLREQUEST_TARGETBRANCH)</_BranchName>
<_BranchName Condition="'$(_BranchName)' == ''">$(BUILD_SOURCEBRANCHNAME)</_BranchName>
</PropertyGroup>

<ItemGroup Condition="'$(UseCodecov)' == 'true'">
<_CoverageReports Include="$(BaseOutputPath)$(PlatformConfig)\coverage\*.xml" />

<_CodecovArgs Include="-f;@(_CoverageReports)" />
<_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="--flag;$(Configuration)" Condition="'$(Configuration)' != ''" />
<_CodecovArgs Include="-t;$(CODECOV_TOKEN)" Condition="'$(CODECOV_TOKEN)' != ''" />
</ItemGroup>

<Message Importance="high" Text="&quot;$(_CodecovPath)&quot; @(_CodecovArgs, ' ')" />
<Exec Condition="'$(UseCodecov)' == 'true'"
Command="&quot;$(_CodecovPath)&quot; @(_CodecovArgs, ' ')" />
</Target>

</Project>
2 changes: 2 additions & 0 deletions build/Dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
<!-- Build/infrastructure Dependencies -->
<PropertyGroup>
<PublishSymbolsPackageVersion>1.0.0-beta-62824-02</PublishSymbolsPackageVersion>
<CodecovVersion>1.1.0</CodecovVersion>
<CoverletVersion>2.5.1</CoverletVersion>
</PropertyGroup>

<!-- Test-only Dependencies -->
Expand Down
13 changes: 11 additions & 2 deletions build/ci/phase-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,18 @@ phases:
displayName: Download Benchmark Data
- ${{ if eq(parameters.name, 'MacOS') }}:
- script: brew update && brew install libomp mono-libgdiplus gettext && brew link gettext --force
displayName: Install runtime dependencies
displayName: Install runtime dependencies
- script: $(_buildScript) -$(_configuration) -runtests -coverage=true
displayName: Run Tests with code coverage.
condition: and(eq(variables._phaseName, 'Windows_x64'), eq(variables._configuration, 'Debug'))
- script: $(_buildScript) -$(_configuration) -runtests
displayName: Run Tests
displayName: Run Tests without code coverage.
condition: not(and(eq(variables._phaseName, 'Windows_x64'), eq(variables._configuration, 'Debug')))
- script: dotnet msbuild build/Codecov.proj /t:Codecov /p:UseCodecov=true
env:
CODECOV_TOKEN: $(CODECOV_TOKEN)
displayName: Upload coverage to codecov.io
condition: and(eq(variables._phaseName, 'Windows_x64'), eq(variables._configuration, 'Debug'))
- task: PublishTestResults@2
displayName: Publish Test Results
condition: succeededOrFailed()
Expand Down
6 changes: 6 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
"values": [],
"defaultValue": ""
},
"Coverage": {
"description": "Turn on code coverge.",
"valueType": "property",
"values": ["false", "true"],
"defaultValue": "false"
},
"CleanAllProjects": {
"description": "MsBuild target that deletes the binary output directory.",
"valueType": "target",
Expand Down
14 changes: 14 additions & 0 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" Version="2.4.0-prerelease-63213-02" />
<PackageReference Include="coverlet.msbuild" Version="$(CoverletVersion)" />
<PackageReference Include="Codecov" Version="$(CodecovVersion)" />
</ItemGroup>

<PropertyGroup Condition="'$(Coverage)' == 'true'">
<CollectCoverage>true</CollectCoverage>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <!-- https://github.com/tonerdo/coverlet/issues/72 -->
<CoverletOutputFormat>opencover</CoverletOutputFormat>
<CoverletOutput>$(BaseOutputPath)$(PlatformConfig)\coverage\$(MSBuildProjectName).xml</CoverletOutput>
<Include>[Microsoft.ML.*]*</Include>
<!-- Excluding for perf reasons. These classes have tests that can be run conditionally
but they need to be migrated. Excluding these classes should have very minimal effect on code coverage.
-->
<Exclude>[*]Microsoft.ML.*Contracts*,[*]Microsoft.ML.Internal.Utilities*,[*]Microsoft.ML.Data.VBuffer*</Exclude>
</PropertyGroup>

</Project>