Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ 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)
[![codecov](https://codecov.io/gh/dotnet/machinelearning/branch/master/graph/badge.svg?flag=production)](https://codecov.io/gh/dotnet/machinelearning)

| | Debug | Release |
|:---|----------------:|------------------:|
Expand Down
16 changes: 13 additions & 3 deletions build/Codecoverage.proj
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,22 @@
<_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;$(CodeCovToken)" Condition="'$(CodeCovToken)' != ''" />

<_CodecovFlags Include="$(Configuration)" Condition="'$(Configuration)' != ''" />
<_CodecovProductionFlags Include="@(_CodecovFlags)" />
<_CodecovProductionFlags Include="production" />
<_CodecovTestFlags Include="@(_CodecovFlags)" />
<_CodecovTestFlags Include="test" />
</ItemGroup>

<Message Importance="high" Text="&quot;$(_CodecovPath)&quot; @(_CodecovArgs, ' ')" />
<Exec Command="&quot;$(_CodecovPath)&quot; @(_CodecovArgs, ' ')" />
<!-- Upload the coverage file with a 'production' flag, which will be filtered by codecov.io to production code -->
<Message Importance="high" Text="&quot;$(_CodecovPath)&quot; @(_CodecovArgs, ' ') --flag @(_CodecovProductionFlags, ',')" />
<Exec Command="&quot;$(_CodecovPath)&quot; @(_CodecovArgs, ' ') --flag @(_CodecovProductionFlags, ',')" />

<!-- Upload the coverage file with a 'test' flag, which will be filtered by codecov.io to test code -->
<Message Importance="high" Text="&quot;$(_CodecovPath)&quot; @(_CodecovArgs, ' ') --flag @(_CodecovTestFlags, ',')" />
<Exec Command="&quot;$(_CodecovPath)&quot; @(_CodecovArgs, ' ') --flag @(_CodecovTestFlags, ',')" />
</Target>

</Project>
4 changes: 1 addition & 3 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ coverage:
default: false
fixes:
- "build/::/"
ignore:
- "test"

comment:
layout: "diff"
layout: "diff,flags"

flags:
production:
Expand Down
14 changes: 14 additions & 0 deletions test/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,18 @@

<Import Project="..\Directory.Build.targets" />

<!-- Workaround for https://github.com/tonerdo/coverlet/pull/318 -->
<Target Name="UpdateTargetPathForCoverage" BeforeTargets="InstrumentModulesNoBuild;InstrumentModulesAfterBuild">
<PropertyGroup>
<_CoverletOriginalTargetPath>$(TargetPath)</_CoverletOriginalTargetPath>
<TargetPath>$([System.IO.Path]::GetDirectoryName($(TargetPath)))\NonExistent.dll</TargetPath>
</PropertyGroup>
</Target>

<Target Name="UpdateTargetPathAfterCoverage" AfterTargets="InstrumentModulesNoBuild;InstrumentModulesAfterBuild">
<PropertyGroup>
<TargetPath>$(_CoverletOriginalTargetPath)</TargetPath>
</PropertyGroup>
</Target>

</Project>