public void CanCheckoutProject() { var executableDirectory = DirectoryHelper.ExecutingDirectory(); var outputDirectory = Path.Combine(executableDirectory.FullName, "SubversionOutput"); var tasks = TaskHelper.Start() .Subversion("http://openjpeg.googlecode.com/svn/trunk/", outputDirectory) .Finalize(); var command = new KissCommand("build", tasks); var project = new KissProject("TestProject", "UI", command); using (var projectService = TestHelper.GetService()) { projectService.RegisterProject(project); ProjectHelper.Run(project, command, projectService); var output = new DirectoryInfo(outputDirectory); Assert.IsTrue(output.EnumerateFiles().Any()); } }
public void CanRobocopy() { var executableDirectory = DirectoryHelper.ExecutingDirectory(); var outputDirectory = Path.Combine(executableDirectory.FullName, "Robo"); var tasks = TaskHelper.Start() .AddTask("Initialize directories", (ctx, arg) => { var tempDir1 = new TempDirectory(outputDirectory, ctx.ProjectName); var tempDir2 = new TempDirectory(outputDirectory, ctx.ProjectName); File.AppendAllText(Path.Combine(tempDir1.DirectoryPath, "testfile.txt"), "test data"); ctx.RegisterCleanup(() => { tempDir1.Dispose(); tempDir2.Dispose(); }); return new RobocopyArgs(tempDir1.DirectoryPath, tempDir2.DirectoryPath); }) .Robocopy() .AddStep((ctx, arg) => { var exists = File.Exists(Path.Combine(arg.CopiedToDirectory, "testfile.txt")); Assert.IsTrue(exists); return exists; }) .Finalize(); var command = new KissCommand("build", tasks); var project = new KissProject("TestProject", "UI", command); using (var projectService = TestHelper.GetService()) { projectService.RegisterProject(project); ProjectHelper.Run(project, command, projectService); } }
public void CanRunTestProject() { var executableDirectory = DirectoryHelper.ExecutingDirectory(); var outputDirectory = Path.Combine(executableDirectory.FullName, "TestOutput"); var testDll = Path.Combine(executableDirectory.FullName, "KissCI.Tests.FakeTests.dll"); DirectoryHelper.CleanAndEnsureDirectory(outputDirectory); var testResultsPath = Path.Combine(outputDirectory, "testresults.trx"); var tasks = TaskHelper.Start() .MsTest(testDll, testResultsPath) .Finalize(); var command = new KissCommand("build", tasks); var project = new KissProject("TestProject", "UI", command); using (var projectService = TestHelper.GetService()) { projectService.RegisterProject(project); ProjectHelper.Run(project, command, projectService); } Assert.IsTrue(File.Exists(testResultsPath)); }
KissProject GetServiceProject() { var root = @"C:\Projects\Builds\"; var sourceRoot = Path.Combine(root, "Source"); var sourceOutput = Path.Combine(sourceRoot, "KissCI"); var tempRoot = Path.Combine(root, "TempDirectories"); var outputDir = Path.Combine(root, "BuildOutput"); var outputTo = Path.Combine(outputDir, "KissCI.Service"); var outputWebTo = Path.Combine(outputTo, "KissCI.Web"); EnsureDirectories(root, sourceRoot, sourceOutput, tempRoot, outputDir, outputTo, outputWebTo); var serviceTask = TaskHelper.Start() .Git("file://C:/Projects/KissCI", sourceOutput) .TempMsBuild4_0(tempRoot, Path.Combine(sourceOutput, "KissCI.Tests", "KissCI.Tests.csproj"), "Debug") .AddStep((ctx, arg) => { return new MsTestArgs( Path.Combine(arg.OutputPath, "KissCI.Tests.dll"), Path.Combine(arg.OutputPath, "results.trx"), Path.Combine(sourceOutput, "KissCI.testsettings")); }) .MsTest() .TempMsBuild4_0(tempRoot, Path.Combine(sourceOutput, "KissCI.Service", "KissCI.Service.csproj"), "Debug") .AddStep((ctx, arg) => { return new RobocopyArgs(arg.OutputPath, outputTo); }) .Robocopy() .TempMsBuild4_0(tempRoot, Path.Combine(sourceOutput, "KissCI.Web", "KissCI.Web.csproj"), "Debug") .AddStep((ctx, arg) => { return new RobocopyArgs(Path.Combine(arg.OutputPath, "_PublishedWebsites", "KissCI.Web"), outputWebTo); }) .Robocopy() .AddTask("Ensure Projects folder", (ctx, arg) => { var projectsPath = Path.Combine(outputTo, "Projects"); DirectoryHelper.EnsureDirectory(projectsPath); return arg; }) .AddStep((ctx, arg) => { return new ZipArgs { DirectoryPath = outputTo, FilePath = Path.Combine(outputDir, "KissCI.Service.zip") }; }) .Zip() .AddStep((ctx, arg) => { return new GithubUploaderArgs { GithubUser = "******", GithubPassword = "******", FilePath = arg.FilePath, Owner = "jgreene", Repository = "KissCI", Description = "KissCI latest" }; }) .GithubUpload() .Finalize(); var serviceCommand = new KissCommand("build", serviceTask, new IntervalTrigger(TimeHelper.Now)); return new KissProject("KissCI.Service", "Services", serviceCommand); }