In order to use this addin, add to your Cake script
#tool nuget:?package=Codecov
#addin nuget:?package=Cake.Codecov
Then use one of the following snippets to upload your coverage report to Codecov
Task("Upload-Coverage")
.Does(() =>
{
// Upload a coverage report.
Codecov("coverage.xml");
});
Task("Upload-Coverage")
.Does(() =>
{
// Upload coverage reports.
Codecov(new[] { "coverage1.xml", "coverage2.xml" });
});
Task("Upload-Coverage")
.Does(() =>
{
// Upload a coverage report by providing the Codecov upload token.
Codecov("coverage.xml", "00000000-0000-0000-0000-000000000000");
});
Task("Upload-Coverage")
.Does(() =>
{
// Upload coverage reports by providing the Codecov upload token.
Codecov(new[] { "coverage1.xml", "coverage2.xml" }, "00000000-0000-0000-0000-000000000000");
});
Task("Upload-Coverage")
.Does(() =>
{
// Upload a coverage report using the CodecovSettings.
Codecov(new CodecovSettings {
Files = new[] { "coverage.xml" },
Token = "00000000-0000-0000-0000-000000000000",
Flags = "ut"
});
});
Documentation for the addin can be found on the Cake Website.
- The codecov-exe uploader defined in
#tool nuget:?package=Codecov
currently only supports windows builds. However, OS X and Linux builds should come soon. In the mean time, there is a bash global uploader that can be used. - Many CI services (like AppVeyor) do not require you to provide a Codecov upload token. However, TeamCity is a rare exception.
- Using Codecov with TeamCity MAY require configuration. Please refer to the codecov-exe documentation.
Feel free to open an issue or ask a question in Gitter by tagging us: @larzw and/or @AdmiringWorm.
- Coverage report upload fails when using gitversion (or other tools that change the appveyor build version)
Workaround: Add the following in your Upload Coverage task
Task("Upload-Coverage") .Does(() => { var buildVersion = string.Format("{0}.build.{1}", variableThatStores_GitVersion_FullSemVer, BuildSystem.AppVeyor.Environment.Build.Version ); var settings = new CodecovSettings { Files = new[] { "coverage.xml" }, EnvironmentVariables = new Dictionary<string,string> { { "APPVEYOR_BUILD_VERSION", buildVersion } } }; Codecov(settings); });