public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; StandardGlobalInfo globalInfo = CreateStandardGlobalInfo() .AddDotnet() .SetCIBuildTag(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); Cake.DeleteFiles("Tests/**/TestResult*.xml"); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { globalInfo.GetDotnetSolution().Test(); }); Task("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .IsDependentOn("Unit-Testing") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-Artifacts") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .Does(() => { globalInfo.PushArtifacts(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Artifacts"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; StandardGlobalInfo globalInfo = CreateStandardGlobalInfo() .AddDotnet() .SetCIBuildTag(); Task("Check-Repository") .Does(() => { Console.WriteLine($"Environment.OSVersion: {Environment.OSVersion}"); globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder.ToString()); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { globalInfo.GetDotnetSolution().Test(); }); Task("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .IsDependentOn("Unit-Testing") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-Artifacts") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .Does(async() => { await globalInfo.PushArtifactsAsync(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Artifacts"); }
public Build() { try { Cake.Log.Verbosity = Verbosity.Diagnostic; StandardGlobalInfo globalInfo = new StandardGlobalInfo(Cake) .AddDotnet(); globalInfo.GetDotnetSolution().Clean(); globalInfo.GetDotnetSolution().Build(); globalInfo.GetDotnetSolution().Test(); Cake.DotNetCorePublish("MarketFlight"); string SourcePath = @"MarketFlight/bin/Debug/netcoreapp3.1/publish/"; string release = "release/"; //Now Create all of the directories foreach (string dirPath in Directory.GetDirectories(SourcePath, "*", SearchOption.AllDirectories)) { Directory.CreateDirectory(dirPath.Replace(SourcePath, release)); } //Copy all the files & Replaces any files with the same name foreach (string newPath in Directory.GetFiles(SourcePath, "*.*", SearchOption.AllDirectories)) { File.Copy(newPath, newPath.Replace(SourcePath, release), true); } } catch (Exception e) { Console.WriteLine(e); throw e; } Task("Default"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; StandardGlobalInfo globalInfo = CreateStandardGlobalInfo() .AddDotnet() .SetCIBuildTag(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .IsDependentOn("Build") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-Artifacts") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .Does(() => { globalInfo.PushArtifacts(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Artifacts"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; StandardGlobalInfo globalInfo = CreateStandardGlobalInfo() .AddDotnet() .SetCIBuildTag(); Task("Check-Repository") .Does(() => { // We currently produce nothing so TerminateIfShouldStop // always stops the build script. // globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { globalInfo.GetDotnetSolution().Test(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Unit-Testing"); }
void StandardCreateNuGetPackages(StandardGlobalInfo globalInfo) { globalInfo.GetDotnetSolution().Pack(); }
void StandardUnitTests(StandardGlobalInfo globalInfo, IEnumerable <SolutionProject> testProjects) { globalInfo.GetDotnetSolution().Test(); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; StandardGlobalInfo globalInfo = CreateStandardGlobalInfo() .AddDotnet() .SetCIBuildTag(); Setup(context => { context.Log.Information("Executed BEFORE the first task."); }); Teardown(context => { context.Log.Information("Executed AFTER the last task."); }); TaskSetup(setupContext => { setupContext.Log.Information($"TaskSetup for Task: {setupContext.Task.Name}"); }); TaskTeardown(teardownContext => { teardownContext.Log.Information($"TaskTeardown for Task: {teardownContext.Task.Name}"); }); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder.ToString()); Cake.DeleteFiles("Tests/**/TestResult*.xml"); }); Task("Build") .IsDependentOn("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .IsDependentOn("Build") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-NuGet-Packages") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .Does(async() => { await globalInfo.PushArtifactsAsync(); }); Task("Default").IsDependentOn("Push-NuGet-Packages"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo(); StandardGlobalInfo globalInfo = CreateStandardGlobalInfo(gitInfo) .AddDotnet() .SetCIBuildTag(); var nuGetType = globalInfo.ArtifactTypes.OfType <NuGetArtifactType>().Single(); //Because this CCB is our reference for the ApplySettings, we must not modify Build.NuGetArtifactType.GetRemoteFeeds //So here we modify the feed. IList <ArtifactFeed> feeds = nuGetType.GetTargetFeeds(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { globalInfo.GetDotnetSolution().Test(); }); Task("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Unit-Testing") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-Artifacts") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .Does(() => { // Cheat here for this build.cs to avoid changing the default // // protected override IEnumerable<ArtifactFeed> GetRemoteFeeds() // { // yield return new SignatureVSTSFeed( this, "Signature-Code", "CKEnvTest3" ); // } // // that is targeted by the CK.Env.Plugin.NuGetCodeCakeBuilderFolder.AdaptBuildNugetRepositoryForPushFeeds // method. // globalInfo.PushArtifacts(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Artifacts"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo(); StandardGlobalInfo globalInfo = CreateStandardGlobalInfo(gitInfo) .AddDotnet() .SetCIBuildTag(); Setup(context => { context.Information("Executed BEFORE the first task."); }); Teardown(context => { context.Information("Executed AFTER the last task."); }); TaskSetup(setupContext => { setupContext.Information($"TaskSetup for Task: {setupContext.Task.Name}"); }); TaskTeardown(teardownContext => { teardownContext.Information($"TaskTeardown for Task: {teardownContext.Task.Name}"); }); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); Cake.DeleteFiles("Tests/**/TestResult*.xml"); }); // Use N as the first answser: this test takes a looong time (why?) // In -autointeraction mode, this will be skipped (unless explicitly asked from the command line). Task("AutoTests") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunAutoTests", "Run Auto Tests (for Dynamic paths)?", 'N', 'Y') == 'Y') .Does(() => { void ShouldFindAutoTestFolderFromDynamicPaths(bool shouldFind) { string[] paths = Cake.Environment.GetEnvironmentVariable("PATH").Split(new char[] { Cake.Environment.Platform.IsUnix() ? ':' : ';' }, StringSplitOptions.RemoveEmptyEntries); // Cake does not normalize the paths to System.IO.Path.DirectorySeparatorChar. We do it here. string af = Cake.Environment.WorkingDirectory.FullPath + "/CodeCakeBuilder/AutoTests".Replace('\\', '/'); bool autoFolder = paths.Select(p => p.Replace('\\', '/')).Contains(af); if (autoFolder != shouldFind) { throw new Exception(shouldFind ? "AutoTests folder should be found." : "AutoTests folder should not be found."); } } void ShouldFindTestTxtFileFromDynamicPaths(bool shouldFind) { string[] paths = Cake.Environment.GetEnvironmentVariable("PATH").Split(new char[] { Cake.Environment.Platform.IsUnix() ? ':' : ';' }, StringSplitOptions.RemoveEmptyEntries); bool findTestTxtFileInPath = paths.Select(p => System.IO.Path.Combine(p, "Test.txt")).Any(f => System.IO.File.Exists(f)); if (findTestTxtFileInPath != shouldFind) { throw new Exception(shouldFind ? "Should find Text.txt file." : "Should not find Test.txt file."); } } if (System.IO.Directory.Exists("CodeCakeBuilder/AutoTests")) { Cake.DeleteDirectory("CodeCakeBuilder/AutoTests", new DeleteDirectorySettings() { Recursive = true, Force = true }); } ShouldFindAutoTestFolderFromDynamicPaths(false); ShouldFindTestTxtFileFromDynamicPaths(false); Cake.CreateDirectory("CodeCakeBuilder/AutoTests/TestDynamic0"); ShouldFindAutoTestFolderFromDynamicPaths(true); ShouldFindTestTxtFileFromDynamicPaths(false); System.IO.File.WriteAllText("CodeCakeBuilder/AutoTests/TestDynamic0/Test.txt", "c"); ShouldFindAutoTestFolderFromDynamicPaths(true); ShouldFindTestTxtFileFromDynamicPaths(true); Cake.DeleteDirectory("CodeCakeBuilder/AutoTests/TestDynamic0", new DeleteDirectorySettings() { Recursive = true, Force = true }); Cake.CreateDirectory("CodeCakeBuilder/AutoTests/Sub/TestDynamicB"); ShouldFindAutoTestFolderFromDynamicPaths(true); ShouldFindTestTxtFileFromDynamicPaths(false); System.IO.File.WriteAllText("CodeCakeBuilder/AutoTests/Sub/TestDynamicB/Test.txt", "c"); ShouldFindTestTxtFileFromDynamicPaths(true); Cake.DeleteDirectory("CodeCakeBuilder/AutoTests", new DeleteDirectorySettings() { Recursive = true, Force = true }); ShouldFindTestTxtFileFromDynamicPaths(false); ShouldFindAutoTestFolderFromDynamicPaths(false); }); Task("Build") .IsDependentOn("Clean") .IsDependentOn("Check-Repository") .IsDependentOn("AutoTests") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Build") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-NuGet-Packages") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .Does(() => { globalInfo.PushArtifacts(); }); Task("Default").IsDependentOn("Push-NuGet-Packages"); }
void StandardSolutionBuild(StandardGlobalInfo globalInfo, string solutionFileName, params string[] excludedProjectName) { globalInfo.GetDotnetSolution().Build(excludedProjectName); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; StandardGlobalInfo globalInfo = CreateStandardGlobalInfo() .AddDotnet() .SetCIBuildTag(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { var testProjects = globalInfo.GetDotnetSolution().Projects.Where(p => p.Name.EndsWith(".Tests") && !p.Path.Segments.Contains("Integration")); globalInfo.GetDotnetSolution().Test(); }); Task("Create-Packages") .WithCriteria(() => globalInfo.IsValid) .IsDependentOn("Unit-Testing") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-Packages") .WithCriteria(() => globalInfo.IsValid) .IsDependentOn("Create-Packages") .Does(() => { globalInfo.PushArtifacts(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Packages"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; var solutionFileName = Cake.Environment.WorkingDirectory.GetDirectoryName() + ".sln"; var projects = Cake.ParseSolution(solutionFileName) .Projects .Where(p => !(p is SolutionFolder) && p.Name != "CodeCakeBuilder"); // We publish .Tests projects for this solution. var projectsToPublish = projects; StandardGlobalInfo globalInfo = CreateStandardGlobalInfo() .AddDotnet() .SetCIBuildTag(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { globalInfo.GetDotnetSolution().Test(); }); Task("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .IsDependentOn("Unit-Testing") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-Artifacts") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .Does(() => { globalInfo.PushArtifacts(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Artifacts"); }