Skip to content

Instantly share code, notes, and snippets.

@amogram
Created April 25, 2017 16:17
Show Gist options
  • Save amogram/6d5e00ef90c44bd05347c9e7c2b6602f to your computer and use it in GitHub Desktop.
Save amogram/6d5e00ef90c44bd05347c9e7c2b6602f to your computer and use it in GitHub Desktop.
Quick Cake Build Script for NMockaroo.
#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.0
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var buildDir = Directory("../src/NMockaroo/bin") + Directory(configuration);
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore("../src/NMockaroo.sln");
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
if(IsRunningOnWindows())
{
// Use MSBuild
MSBuild("../src/NMockaroo.sln", settings =>
settings.SetConfiguration(configuration));
}
});
Task("Run-Unit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
NUnit3("../src/**/bin/" + configuration + "/*.Tests.dll", new NUnit3Settings {
NoResults = true, Labels = NUnit3Labels.All
});
});
Task("Default")
.IsDependentOn("Run-Unit-Tests");
RunTarget(target);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment