Skip to content

Commit

Permalink
(#49) Remove criteria on testing tasks
Browse files Browse the repository at this point in the history
The criteria for only running these tasks when not doing an official
release means that these tasks will not run on the TeamCity server,
which is really one of the main places that we want this to happen.

In hindsight, these criteria likely shouldn't have ever been added.
  • Loading branch information
gep13 committed May 5, 2022
1 parent 565a22e commit be6fae7
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions Chocolatey.Cake.Recipe/Content/testing.cake
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ 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, () => {
}));

BuildParameters.Tasks.TestNUnitTask = Task("Test-NUnit")
.IsDependentOn("Install-OpenCover")
.WithCriteria(() => BuildParameters.Configuration != "ReleaseOfficial", "Skipping since build configuration is ReleaseOfficial")
.WithCriteria(() => DirectoryExists(BuildParameters.Paths.Directories.PublishedNUnitTests), "No published NUnit tests")
.Does(() => RequireTool(ToolSettings.NUnitTool, () => {
EnsureDirectoryExists(BuildParameters.Paths.Directories.NUnitTestResults);
Expand All @@ -40,7 +38,6 @@ BuildParameters.Tasks.TestNUnitTask = Task("Test-NUnit")

BuildParameters.Tasks.TestxUnitTask = Task("Test-xUnit")
.IsDependentOn("Install-OpenCover")
.WithCriteria(() => BuildParameters.Configuration != "ReleaseOfficial", "Skipping since build configuration is ReleaseOfficial")
.WithCriteria(() => DirectoryExists(BuildParameters.Paths.Directories.PublishedxUnitTests), "No published xUnit tests")
.Does(() => RequireTool(ToolSettings.XUnitTool, () => {
EnsureDirectoryExists(BuildParameters.Paths.Directories.xUnitTestResults);
Expand Down Expand Up @@ -68,7 +65,6 @@ 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 @@ -183,7 +179,6 @@ 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 @@ -200,7 +195,6 @@ BuildParameters.Tasks.GenerateFriendlyTestReportTask = Task("Generate-FriendlyTe
);

BuildParameters.Tasks.ReportUnitTestResultsTask = Task("Report-UnitTestResults")
.WithCriteria(() => BuildParameters.Configuration != "ReleaseOfficial", "Skipping since build configuration is ReleaseOfficial")
.WithCriteria(() => BuildSystem.IsRunningOnTeamCity, "Skipping due to not running on TeamCity")
.Does(() => {
Information("Reporting Unit Test results to TeamCity if any exist...");
Expand All @@ -218,7 +212,6 @@ BuildParameters.Tasks.ReportUnitTestResultsTask = Task("Report-UnitTestResults")
});

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 @@ -301,7 +294,6 @@ 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 || BuildParameters.PreferDotNetGlobalToolUsage ? ToolSettings.ReportGeneratorGlobalTool : ToolSettings.ReportGeneratorTool, () => {
var coverageFiles = GetFiles(BuildParameters.Paths.Directories.TestCoverage + "/coverlet/*.xml");
Expand Down

0 comments on commit be6fae7

Please sign in to comment.