diff --git a/.all-contributorsrc b/.all-contributorsrc
index 40ca950..a33b05c 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -91,6 +91,15 @@
"doc",
"ideas"
]
+ },
+ {
+ "login": "nils-a",
+ "name": "Nils Andresen",
+ "avatar_url": "https://avatars.githubusercontent.com/u/349188?v=4",
+ "profile": "https://blog.nils-andresen.de",
+ "contributions": [
+ "code"
+ ]
}
],
"contributorsPerLine": 7,
@@ -106,5 +115,7 @@
"link": "<%= options.repoHost %>/<%= options.projectOwner %>/<%= options.projectName %>/issues?q=author%3A<%= contributor.login %>"
}
},
- "skipCi": true
+ "skipCi": true,
+ "commitType": "docs",
+ "commitConvention": "angular"
}
diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index 727dfd7..26e2bc1 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -1,12 +1,12 @@
{
- "version": 1,
- "isRoot": true,
- "tools": {
- "cake.tool": {
- "version": "0.38.5",
- "commands": [
- "dotnet-cake"
- ]
+ "version": 1,
+ "isRoot": true,
+ "tools": {
+ "cake.tool": {
+ "version": "1.3.0",
+ "commands": [
+ "dotnet-cake"
+ ]
+ }
}
- }
-}
\ No newline at end of file
+}
diff --git a/.editorconfig b/.editorconfig
index 112b406..fae1055 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -24,6 +24,10 @@ indent_size = 2
indent_size = 2
trim_trailing_whitespace = false
+[.all-contributorsrc]
+indent_style = unset
+indent_size = unset
+
# C# files
[*.cs]
#### .NET Coding Conventions ####
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index d1a5206..ee44663 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -8,6 +8,8 @@ on:
- "release/**"
- "hotfix/**"
- "feature/**"
+ tags:
+ - "*"
pull_request:
jobs:
@@ -15,11 +17,12 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
- os: [windows-2019, ubuntu-18.04, macos-10.15]
+ os: [windows-2022, ubuntu-22.04, macos-13]
env:
AZURE_PASSWORD: ${{ secrets.AZURE_PASSWORD }}
AZURE_SOURCE: ${{ secrets.AZURE_SOURCE }}
AZURE_USER: ${{ secrets.AZURE_USER }}
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITTER_ROOM_ID: ${{ secrets.GITTER_ROOM_ID }}
GITTER_TOKEN: ${{ secrets.GITTER_TOKEN }}
@@ -38,18 +41,26 @@ jobs:
- name: Fetch all tags and branches
run: git fetch --prune --unshallow
- name: Cache Tools
- uses: actions/cache@v2.1.4
+ uses: actions/cache@v4.0.2
with:
path: tools
key: ${{ runner.os }}-tools-${{ hashFiles('setup.cake') }}
+ - name: install .NET versions
+ uses: actions/setup-dotnet@v3.2.0
+ with:
+ # codecov in cake.recipe needs 2.1!
+ # version used for GitReleaseManager needs .NET Core 3.0
+ dotnet-version: |
+ 2.1.x
+ 5.0.x
+ 6.0.x
- name: Build Addin
- uses: cake-build/cake-action@v1
+ uses: cake-build/cake-action@v2
with:
script-path: setup.cake
target: CI
verbosity: Diagnostic
- cake-version: 0.38.5
- cake-bootstrap: true
+ cake-version: tool-manifest
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml
index d656076..78730fd 100644
--- a/.github/workflows/linters.yml
+++ b/.github/workflows/linters.yml
@@ -7,8 +7,8 @@ on:
jobs:
super_linter:
- name: List with Super Linter
- runs-on: ubuntu-18.04
+ name: Lint with Super Linter
+ runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2.3.4
@@ -16,7 +16,7 @@ jobs:
fetch-depth: 0
- name: Lint Code Base
- uses: github/super-linter@v3.15.5
+ uses: github/super-linter@v5.0.0
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: develop
diff --git a/.github/workflows/pre-release-notes.yml b/.github/workflows/pre-release-notes.yml
index 95f306d..31c16c2 100644
--- a/.github/workflows/pre-release-notes.yml
+++ b/.github/workflows/pre-release-notes.yml
@@ -7,7 +7,7 @@ jobs:
draft-pre-release:
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-22.04
steps:
- name: Checkout the requested branch
@@ -15,19 +15,28 @@ jobs:
- name: Fetch all tags and branches
run: git fetch --prune --unshallow
- name: Cache Tools
- uses: actions/cache@v2.1.4
+ uses: actions/cache@v4.0.2
with:
path: tools
key: ${{ runner.os }}-tools-${{ hashFiles('setup.cake') }}
+ - name: install .NET versions
+ uses: actions/setup-dotnet@v3.2.0
+ with:
+ # codecov in cake.recipe needs 2.1!
+ # version used for GitReleaseManager needs .NET Core 3.0
+ dotnet-version: |
+ 2.1.x
+ 5.0.x
+ 6.0.x
- name: Set up git version
if: ${{ !contains(github.ref, '/hotfix/') && !contains(github.ref, '/release/') }}
- uses: gittools/actions/gitversion/setup@v0.9.9
+ uses: gittools/actions/gitversion/setup@v1.1.1
with:
versionSpec: "5.x"
- name: Run git version
if: ${{ !contains(github.ref, '/hotfix/') && !contains(github.ref, '/release/') }}
id: gitversion
- uses: gittools/actions/gitversion/execute@v0.9.9
+ uses: gittools/actions/gitversion/execute@v1.1.1
- name: Create release branch ${{ github.event.inputs.version }}
if: ${{ steps.gitversion.outputs.majorMinorPatch }}
run: git switch -c release/${{ steps.gitversion.outputs.majorMinorPatch }}
diff --git a/.github/workflows/publishdocs.yml b/.github/workflows/publishdocs.yml
index 3fa1768..74e7689 100644
--- a/.github/workflows/publishdocs.yml
+++ b/.github/workflows/publishdocs.yml
@@ -10,7 +10,7 @@ jobs:
WYAM_ACCESS_TOKEN: ${{ secrets.WYAM_ACCESS_TOKEN }}
WYAM_DEPLOY_REMOTE: "${{ github.event.repository.html_url }}"
WYAM_DEPLOY_BRANCH: "gh-pages"
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-22.04
steps:
- name: Checkout the requested branch
@@ -19,15 +19,22 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.ref }}
- name: Cache Tools
- uses: actions/cache@v2.1.4
+ uses: actions/cache@v4.0.2
with:
path: tools
key: ${{ runner.os }}-doc-tools-${{ hashFiles('setup.cake') }}
+ - name: install .NET versions
+ uses: actions/setup-dotnet@v3.2.0
+ with:
+ # codecov in cake.recipe needs 2.1!
+ dotnet-version: |
+ 2.1.x
+ 3.1.x
+ 5.0.x
- name: Publishing documentaiton
- uses: cake-build/cake-action@v1
+ uses: cake-build/cake-action@v2
with:
script-path: setup.cake
target: Force-Publish-Documentation
verbosity: Diagnostic
- cake-version: 0.38.5
- cake-bootstrap: true
+ cake-version: tool-manifest
diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml
index 3de9233..3466207 100644
--- a/.github/workflows/release-notes.yml
+++ b/.github/workflows/release-notes.yml
@@ -7,7 +7,7 @@ jobs:
draft-stable:
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-22.04
steps:
- name: Checkout the requested branch
@@ -15,19 +15,28 @@ jobs:
- name: Fetch all tags and branches
run: git fetch --prune --unshallow
- name: Cache Tools
- uses: actions/cache@v2.1.4
+ uses: actions/cache@v4.0.2
with:
path: tools
key: ${{ runner.os }}-tools-${{ hashFiles('setup.cake') }}
+ - name: install .NET versions
+ uses: actions/setup-dotnet@v3.2.0
+ with:
+ # codecov in cake.recipe needs 2.1!
+ # version used for GitReleaseManager needs .NET Core 3.0
+ dotnet-version: |
+ 2.1.x
+ 5.0.x
+ 6.0.x
- name: Set up git version
if: ${{ !contains(github.ref, '/hotfix/') && !contains(github.ref, '/release/') }}
- uses: gittools/actions/gitversion/setup@v0.9.9
+ uses: gittools/actions/gitversion/setup@v1.1.1
with:
versionSpec: "5.x"
- name: Run git version
if: ${{ !contains(github.ref, '/hotfix/') && !contains(github.ref, '/release/') }}
id: gitversion
- uses: gittools/actions/gitversion/execute@v0.9.9
+ uses: gittools/actions/gitversion/execute@v1.1.1
- name: Create release branch ${{ github.event.inputs.version }}
if: ${{ steps.gitversion.outputs.majorMinorPatch }}
run: git switch -c release/${{ steps.gitversion.outputs.majorMinorPatch }}
@@ -38,10 +47,9 @@ jobs:
branch: "release/${{ steps.gitversion.outputs.majorMinorPatch }}"
github_token: ${{ secrets.GH_TOKEN }}
- name: Drafting Release Notes
- uses: cake-build/cake-action@v1
+ uses: cake-build/cake-action@v2
with:
script-path: setup.cake
target: releasenotes
verbosity: Diagnostic
- cake-version: 0.38.5
- cake-bootstrap: true
+ cake-version: tool-manifest
diff --git a/.jscpd.json b/.jscpd.json
new file mode 100644
index 0000000..86ad77a
--- /dev/null
+++ b/.jscpd.json
@@ -0,0 +1,10 @@
+{
+ "absolute": true,
+ "ignore": [
+ "Source/*.Tests/**"
+ ],
+ "reporters": [
+ "consoleFull"
+ ],
+ "threshold": 0.1
+}
diff --git a/.mergify.yml b/.mergify.yml
index 7e65547..60f0f2d 100644
--- a/.mergify.yml
+++ b/.mergify.yml
@@ -32,7 +32,6 @@ pull_request_rules:
actions:
merge:
method: squash
- strict: smart
- name: thank user and refer them to add themself as contributor
conditions:
- merged
diff --git a/README.md b/README.md
index c18e4b2..b3002b6 100644
--- a/README.md
+++ b/README.md
@@ -3,11 +3,12 @@
[![All Contributors][all-contributorsimage]](#contributors)
[![AppVeyor branch](https://img.shields.io/appveyor/ci/cakecontrib/cake-codecov/master.svg)](https://ci.appveyor.com/project/cakecontrib/cake-codecov/branch/master)
[![NuGet](https://img.shields.io/nuget/v/Cake.Codecov.svg)](https://www.nuget.org/packages/Cake.Codecov/)
-[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg?maxAge=2592000)](https://gitter.im/cake-contrib/Lobby)
[![Codecov](https://img.shields.io/codecov/c/github/cake-contrib/Cake.Codecov.svg)](https://codecov.io/gh/cake-contrib/Cake.Codecov)
-[![SonarCloud Quality Gate](https://img.shields.io/sonar/quality_gate/cake-contrib_Cake.Codecov?logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io)](https://sonarcloud.io/dashboard?id=cake-contrib_Cake.Codecov)
-A [Cake](https://cakebuild.net) addin that extends Cake with the ability to use [Codecov](https://codecov.io) ([.NET Edition](https://github.com/codecov/codecov-exe)).
+A [Cake](https://cakebuild.net) addin that extends Cake with the ability to use
+the official
+[Codecov](https://docs.codecov.com/docs/codecov-uploader#using-the-cli) CLI that
+have been repackaged as a NuGet package named [CodecovUploader](https://www.nuget.org/packages/CodecovUploader).
@@ -27,15 +28,12 @@ A [Cake](https://cakebuild.net) addin that extends Cake with the ability to use
In order to use this addin, add to your Cake script
```csharp
-#tool nuget:?package=Codecov
-#addin nuget:?package=Cake.Codecov
+#tool nuget:?package=CodecovUploader
+#addin nuget:?package=Cake.Codecov // Any versions before 1.1.0 is not guaranteed to work anymore.
```
Then use one of the following snippets to upload your coverage report to Codecov.
-*NOTE: Starting for codecov version [1.6.0](https://github.com/codecov/codecov-exe/releases/tag/1.6.0) globbing
-patterns are also supported for file paths.*
-
```csharp
Task("Upload-Coverage")
.Does(() =>
@@ -87,13 +85,14 @@ Task("Upload-Coverage")
## Documentation
-Documentation for the addin can be found on the [Cake Website](http://cakebuild.net/dsl/codecov/).
+Documentation for the addin can be found on the [Cake Website](https://cakebuild.net/extensions/cake-codecov/).
## Codecov Tips
-1. The [codecov-exe](https://github.com/codecov/codecov-exe) uploader defined in `#tool nuget:?package=Codecov` currently supports Windows, OSX and Linux builds. (_Note: There also the [Codecov.Tool](https://www.nuget.org/packages/Codecov.Tool) utility)
-2. CI Services like AppVeyor and Travis CI do not require a Codecov upload token. Any other provider would need one to be specified on the command line or through an Environment variable called `CODECOV_TOKEN`. See all supported CI providers in the [codecov-exe documentation](https://github.com/codecov/codecov-exe#ci-providers)
-3. Using Codecov with TeamCity MAY require configuration. Please refer to the [codecov-exe documentation](https://github.com/codecov/codecov-exe#teamcity).
+1. While CI Service like GitHub Action, these workflows are likely to hit a rate
+ limit on Codecov. As such it is recommended to always pass in a repository or
+ global token when one is available.
+2. Do not set NonZero to `true` when running without a Codecov token.
## Questions
@@ -132,19 +131,22 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
diff --git a/Source/Cake.Codecov.Tests/Cake.Codecov.Tests.csproj b/Source/Cake.Codecov.Tests/Cake.Codecov.Tests.csproj
index 51ee74e..fabe834 100644
--- a/Source/Cake.Codecov.Tests/Cake.Codecov.Tests.csproj
+++ b/Source/Cake.Codecov.Tests/Cake.Codecov.Tests.csproj
@@ -8,13 +8,13 @@
-
+
runtime; build; native; contentfiles; analyzers
all
-
-
-
+
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/Source/Cake.Codecov.Tests/CodecovRunnerTests.cs b/Source/Cake.Codecov.Tests/CodecovRunnerTests.cs
index e8d00da..b35ee3a 100644
--- a/Source/Cake.Codecov.Tests/CodecovRunnerTests.cs
+++ b/Source/Cake.Codecov.Tests/CodecovRunnerTests.cs
@@ -1,10 +1,11 @@
+using System;
+using System.Runtime.InteropServices;
using Cake.Codecov.Internals;
using Cake.Codecov.Tests.Attributes;
using Cake.Core;
using Cake.Testing;
using FluentAssertions;
using Moq;
-using System;
using Xunit;
namespace Cake.Codecov.Tests
@@ -107,6 +108,7 @@ public void Should_Find_Codecov_Runner_If_Tool_Path_Not_Provided_On_Windows()
[Theory]
[InlineData("linux-x64/codecov")]
+ [InlineData("codecov-linux")]
[InlineData("codecov")]
public void Should_Find_Codecov_Runner_If_Tool_Path_Not_Provided_On_Linux(string path)
{
@@ -129,6 +131,7 @@ public void Should_Find_Codecov_Runner_If_Tool_Path_Not_Provided_On_Linux(string
[Theory]
[InlineData("linux-x64/codecov")]
+ [InlineData("codecov-macos")]
[InlineData("codecov")]
public void Should_Find_Codecov_Runner_If_Tool_Path_Not_Provided_On_osx(string path)
{
@@ -216,6 +219,32 @@ public void Should_Set_Build()
result.Args.Should().Be(@"--build ""1""");
}
+ [Fact]
+ public void Should_EnableClean()
+ {
+ // Given
+ var fixture = new CodecovRunnerFixture { Settings = { CleanReports = true } };
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ result.Args.Should().Be(@"--clean");
+ }
+
+ [Fact]
+ public void Should_Not_Enable_Clean()
+ {
+ // Given
+ var fixture = new CodecovRunnerFixture { Settings = { CleanReports = false } };
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ result.Args.Should().BeNullOrEmpty();
+ }
+
[Fact]
public void Should_Set_Commit()
{
@@ -229,8 +258,8 @@ public void Should_Set_Commit()
result.Args.Should().Be(@"--sha ""603e02d40093d0649cfa787d846ae4ccc038085c""");
}
- [Fact]
- public void Should_Enable_DisableNetwork()
+ [Fact, Obsolete("Remove test in v2.0.0")]
+ public void Should_Enable_DryRun_When_DisableNetwork_Is_Set()
{
// Given
var fixture = new CodecovRunnerFixture { Settings = { DisableNetwork = true } };
@@ -239,11 +268,11 @@ public void Should_Enable_DisableNetwork()
var result = fixture.Run();
// Then
- result.Args.Should().Be("--disable-network");
+ result.Args.Should().Be("--dryRun");
}
- [Fact]
- public void Should_Enable_Dump()
+ [Fact, Obsolete("Remove test in v2.0.0")]
+ public void Should_Enable_DryRun_When_Dump_Is_Set()
{
// Given
var fixture = new CodecovRunnerFixture { Settings = { Dump = true } };
@@ -252,7 +281,20 @@ public void Should_Enable_Dump()
var result = fixture.Run();
// Then
- result.Args.Should().Be("--dump");
+ result.Args.Should().Be("--dryRun");
+ }
+
+ [Fact]
+ public void Should_Enable_DryRun()
+ {
+ // Given
+ var fixture = new CodecovRunnerFixture { Settings = { DryRun = true } };
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ result.Args.Should().Be("--dryRun");
}
[Fact]
@@ -307,6 +349,32 @@ public void Should_Set_Flags()
result.Args.Should().Be(@"--flag ""ut,chrome""");
}
+ [Fact]
+ public void Should_Enable_GCov()
+ {
+ // Given
+ var fixture = new CodecovRunnerFixture { Settings = { EnableGcovSupport = true } };
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ result.Args.Should().Be(@"--gcov");
+ }
+
+ [Fact]
+ public void Should_Not_Enable_GCov()
+ {
+ // Given
+ var fixture = new CodecovRunnerFixture { Settings = { EnableGcovSupport = false } };
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ result.Args.Should().BeNullOrEmpty();
+ }
+
[Fact]
public void Should_Set_Name()
{
@@ -316,12 +384,12 @@ public void Should_Set_Name()
// When
var result = fixture.Run();
- // Then
+ // ThenRæ
result.Args.Should().Be(@"--name ""custom name""");
}
- [Fact]
- public void Should_Enable_NoColor()
+ [Fact, Obsolete("Remove test in v2.0.0")]
+ public void Should_Ignore_NoColor()
{
// Given
var fixture = new CodecovRunnerFixture { Settings = { NoColor = true } };
@@ -330,7 +398,7 @@ public void Should_Enable_NoColor()
var result = fixture.Run();
// Then
- result.Args.Should().Be("--no-color");
+ result.Args.Should().BeNullOrEmpty();
}
[Fact]
@@ -346,8 +414,8 @@ public void Should_Set_Pr()
result.Args.Should().Be(@"--pr ""1""");
}
- [Fact]
- public void Should_Enable_Required()
+ [Fact, Obsolete("Remove in v2.0.0")]
+ public void Should_Enable_NonZero_When_Required_Is_Set()
{
// Given
var fixture = new CodecovRunnerFixture { Settings = { Required = true } };
@@ -356,11 +424,37 @@ public void Should_Enable_Required()
var result = fixture.Run();
// Then
- result.Args.Should().Be("--required");
+ result.Args.Should().Be("--nonZero");
}
[Fact]
- public void Should_Set_Root()
+ public void Should_Enable_NonZero()
+ {
+ // Given
+ var fixture = new CodecovRunnerFixture { Settings = { NonZero = true } };
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ result.Args.Should().Be("--nonZero");
+ }
+
+ [Fact]
+ public void Should_Sete_ParentSha()
+ {
+ // Given
+ var fixture = new CodecovRunnerFixture { Settings = { ParentSha = "some-kind-of-sha" } };
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ result.Args.Should().Be(@"--parent ""some-kind-of-sha""");
+ }
+
+ [Fact, Obsolete("Remove test in v2.0.0")]
+ public void Should_Set_RootDirectory_When_Root_Is_Set()
{
// Given
var fixture = new CodecovRunnerFixture { Settings = { Root = @".\working" } };
@@ -369,7 +463,35 @@ public void Should_Set_Root()
var result = fixture.Run();
// Then
- result.Args.Should().Be(@"--root ""working""");
+ result.Args.Should().Be(@"--rootDir ""working""");
+ }
+
+ [Fact]
+ public void Should_Set_RootDirectory()
+ {
+ // Given
+ var fixture = new CodecovRunnerFixture { Settings = { RootDirectory = @".\working" } };
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ result.Args.Should().Be(@"--rootDir ""working""");
+ }
+
+ [Fact]
+ public void Should_Set_SearchDirectory()
+ {
+ var directory = Environment.CurrentDirectory.Replace("\\", "/");
+
+ // Given
+ var fixture = new CodecovRunnerFixture { Settings = { SearchDirectory = Environment.CurrentDirectory } };
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ result.Args.Should().Be(@$"--dir ""{directory}""");
}
[Fact]
@@ -385,6 +507,32 @@ public void Should_Set_Slug()
result.Args.Should().Be(@"--slug ""owner/repo""");
}
+ [Fact]
+ public void Should_Enable_Changelog()
+ {
+ // Given
+ var fixture = new CodecovRunnerFixture { Settings = { ShowChangelog = true } };
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ result.Args.Should().Be("--changelog");
+ }
+
+ [Fact]
+ public void Should_Not_Enable_Changelog()
+ {
+ // Given
+ var fixture = new CodecovRunnerFixture { Settings = { ShowChangelog = false } };
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ result.Args.Should().BeNullOrEmpty();
+ }
+
[Fact]
public void Should_Set_Tag()
{
diff --git a/Source/Cake.Codecov.Tests/CodecovSettingsTests.cs b/Source/Cake.Codecov.Tests/CodecovSettingsTests.cs
index e4565b2..ebb8c1d 100644
--- a/Source/Cake.Codecov.Tests/CodecovSettingsTests.cs
+++ b/Source/Cake.Codecov.Tests/CodecovSettingsTests.cs
@@ -72,6 +72,20 @@ public void Should_Set_Commit_Value()
}
[Fact]
+ public void Should_Set_Clean_Value()
+ {
+ // Given
+ var settings = new CodecovSettings
+ {
+ // When
+ CleanReports = true
+ };
+
+ // Then
+ settings.CleanReports.Should().BeTrue();
+ }
+
+ [Fact, Obsolete("Remove test in v2.0.0")]
public void Should_Set_DisableNetwork_Value()
{
// Given
@@ -85,7 +99,7 @@ public void Should_Set_DisableNetwork_Value()
settings.DisableNetwork.Should().BeTrue();
}
- [Fact]
+ [Fact, Obsolete("Remove test in v2.0.0")]
public void Should_Set_Dump_Value()
{
// Given
@@ -99,6 +113,20 @@ public void Should_Set_Dump_Value()
settings.Dump.Should().BeTrue();
}
+ [Fact]
+ public void Should_Set_EnableGcovSupport_Value()
+ {
+ // Given
+ var settings = new CodecovSettings
+ {
+ // When
+ EnableGcovSupport = true
+ };
+
+ // Then
+ settings.EnableGcovSupport.Should().BeTrue();
+ }
+
[Fact]
public void Should_Set_Envs_Value()
{
@@ -174,8 +202,8 @@ public void Should_Set_Name_Value()
settings.Name.Should().Be(expected);
}
- [Fact]
- public void Should_Set_NoColor_Value()
+ [Fact, Obsolete("Remove test in v2.0.0")]
+ public void Should_Not_Set_NoColor_Value()
{
// Given
var settings = new CodecovSettings
@@ -185,7 +213,22 @@ public void Should_Set_NoColor_Value()
};
// Then
- settings.NoColor.Should().BeTrue();
+ settings.NoColor.Should().BeFalse();
+ }
+
+ [Fact]
+ public void Should_Set_ParentSha_Value()
+ {
+ // Given
+ const string expected = "some-sha";
+ var settings = new CodecovSettings
+ {
+ // When
+ ParentSha = expected
+ };
+
+ // Then
+ settings.ParentSha.Should().Be(expected);
}
[Fact]
@@ -203,7 +246,7 @@ public void Should_Set_Pr_Value()
settings.Pr.Should().Be(expected);
}
- [Fact]
+ [Fact, Obsolete("Remove test in v2.0.0")]
public void Should_Set_Required_Value()
{
// Given
@@ -217,7 +260,7 @@ public void Should_Set_Required_Value()
settings.Required.Should().BeTrue();
}
- [Fact]
+ [Fact, Obsolete("Remove test in v2.0.0")]
public void Should_Set_Root_Value()
{
// Given
@@ -232,6 +275,50 @@ public void Should_Set_Root_Value()
settings.Root.Should().BeEquivalentTo(expected);
}
+ [Fact]
+ public void Should_Set_RootDirectory_Value()
+ {
+ // Given
+ var expected = (DirectoryPath)"root/other";
+ var settings = new CodecovSettings
+ {
+ // When
+ RootDirectory = expected
+ };
+
+ // Then
+ settings.RootDirectory.Should().BeEquivalentTo(expected);
+ }
+
+ [Fact]
+ public void Should_Set_SearchDirectory_Value()
+ {
+ // Given
+ var expected = (DirectoryPath)"some-search-path";
+ var settings = new CodecovSettings
+ {
+ // When
+ SearchDirectory = expected
+ };
+
+ // Then
+ settings.SearchDirectory.Should().BeEquivalentTo(expected);
+ }
+
+ [Fact]
+ public void Should_Set_ShowChangelog_Value()
+ {
+ // Given
+ var settings = new CodecovSettings
+ {
+ // When
+ ShowChangelog = true
+ };
+
+ // Then
+ settings.ShowChangelog.Should().BeTrue();
+ }
+
[Fact]
public void Should_Set_Slug_Value()
{
diff --git a/Source/Cake.Codecov/Cake.Codecov.csproj b/Source/Cake.Codecov/Cake.Codecov.csproj
index 84da650..fdb3b96 100644
--- a/Source/Cake.Codecov/Cake.Codecov.csproj
+++ b/Source/Cake.Codecov/Cake.Codecov.csproj
@@ -5,7 +5,7 @@
Cake.Codecov.ruleset
Cake Contributors
Copyright Β© 2017-$([System.DateTime]::Today.Year) - Cake Contributors
- Cake addin that extends Cake with the ability to use Codecov (.NET Edition).
+ Cake addin that extends Cake with the ability to use the official Codecov CLI.
bin\$(Configuration)\$(TargetFramework)\Cake.Codecov.xml
en-GB
net5.0;netstandard2.0;net461
@@ -15,8 +15,6 @@
Larz White;Kim Nordmo;Cake Contributors
true
- icon.png
- https://cdn.jsdelivr.net/gh/cake-contrib/graphics@49c3b71def749b86416d773f1ead0c0da2d590ea/png/cake-contrib-medium.png
MIT
https://github.com/cake-contrib/Cake.Codecov
All release notes for Cake.Codecov can be found on the GitHub site - $(PackageProjectUrl)/releases/tag/$(Version).
@@ -25,9 +23,11 @@
$(PackageProjectUrl).git
snupkg
$(AssemblyTitle)
+ docs/README.md
+
@@ -36,13 +36,13 @@
all
-
-
-
+
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/Source/Cake.Codecov/CodecovRunner.cs b/Source/Cake.Codecov/CodecovRunner.cs
index 07e33cd..b35cfa9 100644
--- a/Source/Cake.Codecov/CodecovRunner.cs
+++ b/Source/Cake.Codecov/CodecovRunner.cs
@@ -43,11 +43,13 @@ protected override IEnumerable GetToolExecutableNames()
{
if (_platformDetector.IsLinuxPlatform())
{
+ yield return "codecov-linux";
yield return "linux-x64/codecov";
yield return "codecov";
}
else if (_platformDetector.IsOsxPlatform())
{
+ yield return "codecov-macos";
yield return "osx-x64/codecov";
yield return "codecov";
}
diff --git a/Source/Cake.Codecov/CodecovSettings.cs b/Source/Cake.Codecov/CodecovSettings.cs
index 191bcdb..cb3438b 100644
--- a/Source/Cake.Codecov/CodecovSettings.cs
+++ b/Source/Cake.Codecov/CodecovSettings.cs
@@ -5,20 +5,14 @@
using System;
using System.Collections.Generic;
-
using Cake.Core.IO;
using Cake.Core.Tooling;
namespace Cake.Codecov
{
///
- /// Contains settings used by . See CommandLineOptions
- /// or run.
- ///
- /// .\codecov.exe --help
- ///
- /// for more details.
+ /// Contains settings used by for the new Codecov Uploader provided
+ /// by their team.
///
public sealed class CodecovSettings : ToolSettings
{
@@ -44,6 +38,19 @@ public string Build
set => SetValue("--build", value);
}
+ ///
+ /// Gets or sets a value indicating whether Discovered coverage reports should be moved to
+ /// the trash.
+ ///
+ ///
+ /// A value indicating whether Discovered coverage reports should be moved to the trash.
+ ///
+ public bool CleanReports
+ {
+ get => GetValue("--clean");
+ set => SetValue("--clean", value);
+ }
+
///
/// Gets or sets a property specifing the commit sha.
///
@@ -55,27 +62,52 @@ public string Commit
}
///
- /// Gets or sets a value indicating whether to toggle functionalities. (1) --disable-network.
- /// Disable uploading the file network.
+ /// Gets or sets a value indicating whether to toggle functionalities. (1)
+ /// --disable-network. Disable uploading the file network.
///
///
/// A value indicating whether to toggle functionalities. (1) --disable-network. Disable
/// uploading the file network.
///
+ ///
+ /// This function has been made a no-op, and do not have any functionality.
+ ///
+ [Obsolete("This property have been deprecated, and will be removed in v2.0.0. Use property 'DryRun' instead.")]
public bool DisableNetwork
{
- get => GetValue("--disable-network");
- set => SetValue("--disable-network", value);
+ get => DryRun;
+ set => DryRun = value;
}
///
/// Gets or sets a value indicating whether to don't upload and dump to stdin.
///
/// A value indicating whether to don't upload and dump to stdin.
+ [Obsolete("This property have been deprecated, and will be removed in v2.0.0. Use property 'DryRun' instead.")]
public bool Dump
{
- get => GetValue("--dump");
- set => SetValue("--dump", value);
+ get => DryRun;
+ set => DryRun = value;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether files should be uploaded to Codecov.
+ ///
+ /// A value indicating whether files should be uploaded to Codecov.
+ public bool DryRun
+ {
+ get => GetValue("--dryRun");
+ set => SetValue("--dryRun", value);
+ }
+
+ ///
+ /// Gets or sets a value indicating whether Codecov should run with gcov support or not.
+ ///
+ /// A value indicating whether Codecov should run with gcov support or not.
+ public bool EnableGcovSupport
+ {
+ get => GetValue("--gcov");
+ set => SetValue("--gcov", value);
}
///
@@ -95,9 +127,7 @@ public IEnumerable Envs
///
/// Gets or sets a value specifying which flags should be toggled on/off.
///
- ///
- /// A value specifying which features should be toggled on or off.
- ///
+ /// A value specifying which features should be toggled on or off.
public IEnumerable Features
{
get => GetValue>("--feature");
@@ -112,9 +142,7 @@ public IEnumerable Features
/// A value specifing the target file(s) to upload. (1) -f 'path/to/file'. Only upload this
/// file. (2) -f 'path/to/file1 path/to/file2'. Only upload these files.
///
- ///
- /// Globbing in file paths are supported, but not when path starts with './'.
- ///
+ /// Globbing in file paths are supported, but not when path starts with './'.
public IEnumerable Files
{
get => GetValue>("--file");
@@ -153,10 +181,34 @@ public string Name
/// Gets or sets a value indicating whether to remove color from the output.
///
/// A value indicating whether to remove color from the output.
+ [Obsolete("This property have been deprecated, and will be removed in v2.0.0.")]
public bool NoColor
{
- get => GetValue("--no-color");
- set => SetValue("--no-color", value);
+ get => false;
+ set { }
+ }
+
+ ///
+ /// Gets or sets a value indicating whether Codecov should exit with a non-zero exit code on errors.
+ ///
+ /// Whether Codecov should exit with a non-zero exit code on errors.
+ public bool NonZero
+ {
+ get => GetValue("--nonZero");
+ set => SetValue("--nonZero", value);
+ }
+
+ ///
+ /// Gets or sets the commit SHA of the parent for which you are uploading coverage. If not
+ /// set, the parent will be determined using the API of your repository provider. When using
+ /// the repository provider's API, the parent is determined via finding the closest ancestor
+ /// of the commit.
+ ///
+ /// The commit SHA of the parent for which you are uploading coverage.
+ public string ParentSha
+ {
+ get => GetValue("--parent");
+ set => SetValue("--parent", value);
}
///
@@ -176,25 +228,57 @@ public string Pr
///
/// A value indicating whether to exit with 1 if not successful. Default will Exit with 0.
///
+ [Obsolete("This property have been deprecated, and will be removed in v2.0.0. Use property 'NonZero' instead.")]
public bool Required
{
- get => GetValue("--required");
- set => SetValue("--required", value);
+ get => NonZero;
+ set => NonZero = value;
}
///
/// Gets or sets a value used when not in git project to identify project root directory.
///
/// A value used when not in git project to identify project root directory.
+ [Obsolete("This property have been deprecated, and will be removed in v2.0.0. Use property 'RootDirectory' instead.")]
public DirectoryPath Root
{
- get => GetValue("--root");
- set => SetValue("--root", value?.ToString());
+ get => RootDirectory;
+ set => RootDirectory = value;
+ }
+
+ ///
+ /// Gets or sets the root directory when it is not a git repository.
+ ///
+ /// The root directory when it is not a git repository.
+ public DirectoryPath RootDirectory
+ {
+ get => GetValue("--rootDir");
+ set => SetValue("--rootDir", value);
+ }
+
+ ///
+ /// Gets or sets the directory to use when searching for coverage reports.
+ ///
+ /// The directory to use when searching for coverage reports.
+ public DirectoryPath SearchDirectory
+ {
+ get => GetValue("--dir");
+ set => SetValue("--dir", value);
}
///
- /// Gets or sets a value specifing the owner/repo slug used instead of the private repo token
- /// in Enterprise. (option) Set environment variable CODECOV_SLUG=:owner/:repo.
+ /// Gets or sets a value indicating whether the a link should be displayed to the current changelog.
+ ///
+ /// A value indicating whether a link should be showed to the changelog.
+ public bool ShowChangelog
+ {
+ get => GetValue("--changelog");
+ set => SetValue("--changelog", value);
+ }
+
+ ///
+ /// Gets or sets a value specifing the owner/repo slug used instead of the private repo
+ /// token in Enterprise. (option) Set environment variable CODECOV_SLUG=:owner/:repo.
///
///
/// A value specifing the owner/repo slug used instead of the private repo token in
@@ -217,8 +301,8 @@ public string Tag
}
///
- /// Gets or sets a value specifing the private repository token. (option) set the enviornment
- /// variable CODECOV_TOKEN-uuid. (1) -t @/path/to/token_file. (2) -t uuid.
+ /// Gets or sets a value specifing the private repository token. (option) set the
+ /// enviornment variable CODECOV_TOKEN-uuid. (1) -t @/path/to/token_file. (2) -t uuid.
///
///
/// A value specifing the private repository token. (option) set the enviornment variable
@@ -257,6 +341,17 @@ public bool Verbose
internal IDictionary GetAllArguments()
=> _arguments;
+ ///
+ /// Gets a value that is already set in the underlying dictionary. If no value is set, then
+ /// is returned instead.
+ ///
+ /// The type of the value expected in the dictionary.
+ /// The key or name of the value.
+ /// The default value if no value is found.
+ ///
+ /// The found value with the specified , or the i no value is found.
+ ///
private TValue GetValue(string key, TValue defaultValue = default)
{
if (_arguments.TryGetValue(key, out var objValue) && objValue is TValue value)
@@ -267,6 +362,12 @@ private TValue GetValue(string key, TValue defaultValue = default)
return defaultValue;
}
+ ///
+ /// Sets the specified in the underlying dictionary using the
+ /// specified .
+ ///
+ /// The key to use when adding/updating the dictionary.
+ /// The value to insert.
private void SetValue(string key, object value)
{
if (value is string stringValue && string.IsNullOrWhiteSpace(stringValue))
diff --git a/setup.cake b/setup.cake
index 6f928c4..d87c4e0 100644
--- a/setup.cake
+++ b/setup.cake
@@ -1,66 +1,75 @@
-#load nuget:?package=Cake.Recipe&version=2.2.1
+#load nuget:?package=Cake.Recipe&version=3.1.1
#tool nuget:?package=NuGet.CommandLine&version=5.7.0 // Workaround necessary due to incompatibility with GHA nuget
+#tool nuget:?package=CodecovUploader&version=0.7.3
-Environment.SetVariableNames();
+Environment.SetVariableNames(
+ codecovRepoTokenVariable: "CODECOV_TOKEN" // This is the name that codecov themself expect
+);
BuildParameters.SetParameters(
- context: Context,
- buildSystem: BuildSystem,
- sourceDirectoryPath: "./Source",
- title: "Cake.Codecov",
- repositoryOwner: "cake-contrib",
- repositoryName: "Cake.Codecov",
- appVeyorAccountName: "cakecontrib",
+ context: Context,
+ buildSystem: BuildSystem,
+ sourceDirectoryPath: "./Source",
+ title: "Cake.Codecov",
+ repositoryOwner: "cake-contrib",
+ repositoryName: "Cake.Codecov",
+ appVeyorAccountName: "cakecontrib",
shouldRunDotNetCorePack: true,
shouldGenerateDocumentation: false,
shouldRunCodecov: true,
shouldRunCoveralls: false,
shouldUseDeterministicBuilds: true,
- shouldUseTargetFrameworkPath: false);
+ shouldUseTargetFrameworkPath: false,
+ preferredBuildAgentOperatingSystem: PlatformFamily.Linux,
+ preferredBuildProviderType: BuildProviderType.GitHubActions);
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(
context: Context,
- dupFinderExcludePattern: new string[] {
- BuildParameters.RootDirectoryPath + "/Source/Cake.Codecov.Tests/*.cs"
- },
- dupFinderExcludeFilesByStartingCommentSubstring: new string[] {
- ""
- },
testCoverageFilter: "+[Cake.Codecov]*");
+ToolSettings.SetToolPreprocessorDirectives(
+ codecovTool: "#tool nuget:?package=CodecovUploader&version=0.7.3",
+ gitVersionGlobalTool: "#tool dotnet:?package=GitVersion.Tool&version=5.12.0",
+ gitReleaseManagerGlobalTool: "#tool dotnet:?package=GitReleaseManager.Tool&version=0.17.0");
// Tasks we want to override
-// ((CakeTask)BuildParameters.Tasks.UploadCodecovReportTask.Task).Actions.Clear();
-// BuildParameters.Tasks.UploadCodecovReportTask
-// .IsDependentOn("DotNetCore-Pack")
-// .Does((version) => RequireTool(BuildParameters.IsDotNetCoreBuild ? ToolSettings.CodecovGlobalTool : ToolSettings.CodecovTool, () => {
-// var nugetPkg = $"nuget:file://{MakeAbsolute(BuildParameters.Paths.Directories.NuGetPackages)}?package=Cake.Codecov&version={version.SemVersion}&prerelease";
-// Information("PATH: " + nugetPkg);
+((CakeTask)BuildParameters.Tasks.UploadCodecovReportTask.Task).Actions.Clear();
+BuildParameters.Tasks.UploadCodecovReportTask
+ .IsDependentOn("DotNetCore-Pack")
+ .Does((version) => RequireTool(ToolSettings.CodecovTool, () => {
+ var nugetPkg = $"nuget:file://{MakeAbsolute(BuildParameters.Paths.Directories.NuGetPackages)}?package=Cake.Codecov&version={version.SemVersion}&prerelease";
+ Information("PATH: " + nugetPkg);
+
+ var coverageFilter = BuildParameters.Paths.Directories.TestCoverage + "/coverlet/*.xml";
+ Information($"Passing coverage filter to codecov: \"{coverageFilter}\"");
-// var coverageFilter = BuildParameters.Paths.Directories.TestCoverage + "/coverlet/*.xml";
-// Information($"Passing coverage filter to codecov: \"{coverageFilter}\"");
+ var environmentVariables = new Dictionary();
-// var environmentVariables = new Dictionary();
+ if (version != null && !string.IsNullOrEmpty(version.FullSemVersion))
+ {
+ var buildVersion = string.Format("{0}.build.{1}",
+ version.FullSemVersion,
+ BuildSystem.AppVeyor.Environment.Build.Number);
+ environmentVariables.Add("APPVEYOR_BUILD_VERSION", buildVersion);
+ }
-// if (version != null && !string.IsNullOrEmpty(version.FullSemVersion) && BuildParameters.BuildProvider.SupportsTokenlessCodecov)
-// {
-// var buildVersion = string.Format("{0}.build.{1}",
-// version.FullSemVersion,
-// BuildSystem.AppVeyor.Environment.Build.Number);
-// environmentVariables.Add("APPVEYOR_BUILD_VERSION", buildVersion);
-// }
+ if (!string.IsNullOrEmpty(BuildParameters.Codecov.RepoToken))
+ {
+ environmentVariables.Add("CODECOV_TOKEN", BuildParameters.Codecov.RepoToken);
+ }
-// var script = string.Format(@"#addin ""{0}""
-// Codecov(new CodecovSettings {{
-// Files = new[] {{ ""{1}"" }},
-// Root = ""{2}"",
-// Required = true
-// }});",
-// nugetPkg, coverageFilter, BuildParameters.RootDirectoryPath);
+ var script = string.Format(@"#addin ""{0}""
+Codecov(new CodecovSettings {{
+ Files = new[] {{ ""{1}"" }},
+ RootDirectory = ""{2}"",
+ NonZero = true,
+ DryRun = string.IsNullOrEmpty(EnvironmentVariable(""CODECOV_TOKEN""))
+}});",
+ nugetPkg, coverageFilter, BuildParameters.RootDirectoryPath);
-// RequireAddin(script, environmentVariables);
-// })
-// );
+ RequireAddin(script, environmentVariables);
+ })
+);
Build.RunDotNetCore();