Cake.Codecov 0.7.0

Cake addin that extends Cake with ability to use Codecov.

Install-Package Cake.Codecov -Version 0.7.0
dotnet add package Cake.Codecov --version 0.7.0
<PackageReference Include="Cake.Codecov" Version="0.7.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Cake.Codecov --version 0.7.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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 supports Windows, Linux and OSX. (*Note: There is also the Codecov.Tool utility if you prefer using .NET Core tools.
  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(() =>
    {
        // The logic may differ from what you actually need.
        // This way is for the use with GitVersion.
        // Basically, the buildVersion format needs to be exactly the
        // same as the build version shown on appveyor when the build is done.
        var buildVersion = string.Format("{0}.build.{1}",
            variableThatStores_GitVersion_FullSemVer,
            BuildSystem.AppVeyor.Environment.Build.Number
        );
        var settings = new CodecovSettings {
            Files = new[] { "coverage.xml" },
            EnvironmentVariables = new Dictionary<string,string> { { "APPVEYOR_BUILD_VERSION", buildVersion } }
        };
        Codecov(settings);
    });
    

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 supports Windows, Linux and OSX. (*Note: There is also the Codecov.Tool utility if you prefer using .NET Core tools.
  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(() =>
    {
        // The logic may differ from what you actually need.
        // This way is for the use with GitVersion.
        // Basically, the buildVersion format needs to be exactly the
        // same as the build version shown on appveyor when the build is done.
        var buildVersion = string.Format("{0}.build.{1}",
            variableThatStores_GitVersion_FullSemVer,
            BuildSystem.AppVeyor.Environment.Build.Number
        );
        var settings = new CodecovSettings {
            Files = new[] { "coverage.xml" },
            EnvironmentVariables = new Dictionary<string,string> { { "APPVEYOR_BUILD_VERSION", buildVersion } }
        };
        Codecov(settings);
    });
    

Release Notes

All release notes for Cake.Codecov can be found on the GitHub site - https://github.com/cake-contrib/Cake.Codecov/releases/tag/.

  • .NETFramework 4.6

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.

Showing the top 1 GitHub repositories that depend on Cake.Codecov:

Repository Stars
octokit/octokit.net
A GitHub API client library for .NET

Version History

Version Downloads Last updated
0.7.0 8,813 8/3/2019
0.6.0 17,472 4/26/2019
0.5.0 17,688 12/13/2018
0.4.0 13,386 3/23/2018
0.3.0 6,639 10/23/2017
0.2.1 3,597 6/30/2017
0.2.0 4,165 5/26/2017
0.1.0 374 5/26/2017