Skip to content

Commit

Permalink
(#35) Be consistent about skipped tasks
Browse files Browse the repository at this point in the history
If we are going to skip one unit testing task if we are running an
official build, we should be consistent and skip all the related
tasks.

At some point, we might want to re-think the concept of skipping these
tasks, but for now, consistency is better than anything else.
  • Loading branch information
gep13 committed Apr 29, 2022
1 parent f6be29f commit b85a93d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Chocolatey.Cake.Recipe/Content/testing.cake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ using System.Xml.XPath;
///////////////////////////////////////////////////////////////////////////////

BuildParameters.Tasks.InstallOpenCoverTask = Task("Install-OpenCover")
.WithCriteria(() => BuildParameters.Configuration != "ReleaseOfficial", "Skipping since build configuration is ReleaseOfficial")
.WithCriteria(() => BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows, "Not running on windows")
.Does(() => RequireTool(ToolSettings.OpenCoverTool, () => {
}));
Expand Down Expand Up @@ -67,6 +68,7 @@ BuildParameters.Tasks.TestxUnitTask = Task("Test-xUnit")
);

BuildParameters.Tasks.DotNetCoreTestTask = Task("DotNetCoreTest")
.WithCriteria(() => BuildParameters.Configuration != "ReleaseOfficial", "Skipping since build configuration is ReleaseOfficial")
.IsDependentOn("Install-OpenCover")
.Does(() => {

Expand Down Expand Up @@ -181,6 +183,7 @@ BuildParameters.Tasks.DotNetCoreTestTask = Task("DotNetCoreTest")
BuildParameters.Tasks.GenerateFriendlyTestReportTask = Task("Generate-FriendlyTestReport")
.IsDependentOn("Test-NUnit")
.IsDependentOn("Test-xUnit")
.WithCriteria(() => BuildParameters.Configuration != "ReleaseOfficial", "Skipping since build configuration is ReleaseOfficial")
.WithCriteria(() => BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows, "Skipping due to not running on Windows")
.Does(() => RequireTool(ToolSettings.ReportUnitTool, () =>
{
Expand All @@ -197,6 +200,7 @@ BuildParameters.Tasks.GenerateFriendlyTestReportTask = Task("Generate-FriendlyTe
);

BuildParameters.Tasks.ReportCodeCoverageMetricsTask = Task("Report-Code-Coverage-Metrics")
.WithCriteria(() => BuildParameters.Configuration != "ReleaseOfficial", "Skipping since build configuration is ReleaseOfficial")
.WithCriteria(() => BuildSystem.IsRunningOnTeamCity, "Skipping due to not running on TeamCity")
.Does(() => {
var coverageFiles = GetFiles(BuildParameters.Paths.Directories.TestCoverage + "/coverlet/*.xml");
Expand Down Expand Up @@ -279,6 +283,7 @@ private void ReportCoverageMetric(
}

BuildParameters.Tasks.GenerateLocalCoverageReportTask = Task("Generate-LocalCoverageReport")
.WithCriteria(() => BuildParameters.Configuration != "ReleaseOfficial", "Skipping since build configuration is ReleaseOfficial")
.WithCriteria(() => BuildParameters.IsLocalBuild, "Skipping due to not running a local build")
.Does(() => RequireTool(BuildParameters.IsDotNetCoreBuild ? ToolSettings.ReportGeneratorGlobalTool : ToolSettings.ReportGeneratorTool, () => {
var coverageFiles = GetFiles(BuildParameters.Paths.Directories.TestCoverage + "/coverlet/*.xml");
Expand Down

0 comments on commit b85a93d

Please sign in to comment.