diff --git a/README.md b/README.md
index 35785adbf4..74ab332c5f 100644
--- a/README.md
+++ b/README.md
@@ -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).
+[](https://codecov.io/gh/dotnet/machinelearning)
+
| | Debug | Release |
|:---|----------------:|------------------:|
|**Linux**|[](https://dnceng.visualstudio.com/DotNet-Public/_build/latest?definitionId=104&branch=master)|[](https://dnceng.visualstudio.com/DotNet-Public/_build/latest?definitionId=104&branch=master)|
diff --git a/build/Codecov.proj b/build/Codecov.proj
new file mode 100644
index 0000000000..075b4cc5fb
--- /dev/null
+++ b/build/Codecov.proj
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+ <_CodecovPath>$(RestorePackagesPath)codecov\$(CodecovVersion)\tools\Codecov.exe
+
+ <_BranchName Condition="'$(_BranchName)' == ''">$(SYSTEM_PULLREQUEST_TARGETBRANCH)
+ <_BranchName Condition="'$(_BranchName)' == ''">$(BUILD_SOURCEBRANCHNAME)
+
+
+
+ <_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)' != ''" />
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build/Dependencies.props b/build/Dependencies.props
index d10339d749..bf0155acd9 100644
--- a/build/Dependencies.props
+++ b/build/Dependencies.props
@@ -34,6 +34,8 @@
1.0.0-beta-62824-02
+ 1.1.0
+ 2.5.1
diff --git a/build/ci/phase-template.yml b/build/ci/phase-template.yml
index c7a9303c60..a7ff3f0b60 100644
--- a/build/ci/phase-template.yml
+++ b/build/ci/phase-template.yml
@@ -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()
diff --git a/config.json b/config.json
index c870004f32..eb89171bf7 100644
--- a/config.json
+++ b/config.json
@@ -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",
diff --git a/test/Directory.Build.props b/test/Directory.Build.props
index 30b80439f1..101ef520e9 100644
--- a/test/Directory.Build.props
+++ b/test/Directory.Build.props
@@ -31,6 +31,20 @@
+
+
+
+ true
+ true
+ opencover
+ $(BaseOutputPath)$(PlatformConfig)\coverage\$(MSBuildProjectName).xml
+ [Microsoft.ML.*]*
+
+ [*]Microsoft.ML.*Contracts*,[*]Microsoft.ML.Internal.Utilities*,[*]Microsoft.ML.Data.VBuffer*
+
+