Skip to content

larzw/Cake.Codecov

 
 

Repository files navigation

Cake.Codecov

AppVeyor branch NuGet Gitter Codecov

A Cake addin for Codecov.

Usage

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

Documentation for the addin can be found on the Cake Website.

Codecov Tips

  1. 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.
  2. Many CI services (like AppVeyor) do not require you to provide a Codecov upload token. However, TeamCity is a rare exception.
  3. Using Codecov with TeamCity MAY require configuration. Please refer to the codecov-exe documentation.

Questions

Feel free to open an issue or ask a question in Gitter by tagging us: @larzw and/or @AdmiringWorm.

Known Issues

  • 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);
    });

About

Adds Codecov support to Cake.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 81.7%
  • PowerShell 18.3%