Skip to content

Instantly share code, notes, and snippets.

@yohanmishkin
Last active March 1, 2018 18:46
Show Gist options
  • Save yohanmishkin/dc8e7a71f08c5426ee099a592ee58689 to your computer and use it in GitHub Desktop.
Save yohanmishkin/dc8e7a71f08c5426ee099a592ee58689 to your computer and use it in GitHub Desktop.
Example cake script
// Command line arguments
var target = Argument("target", "Default");
var tag = Argument<string>("tag", "cake");
// 1. Restore
Task("Restore").Does(() => {
DotNetCoreRestore("./src/Hello.Harvester/");
DotNetCoreRestore("./src/Hello.UnitTests/");
});
// 2. Build
Task("Build").Does(() => {
DotNetCoreBuild("./src/Hello.Harvester/");
DotNetCoreBuild("./src/Hello.UnitTests/");
});
// 3. Unit test
Task("Unit tests").Does(() => {
DotNetCoreTool(
"./src/Hello.UnitTests/Hello.UnitTests.csproj",
"xunit",
"-xml ../../test-results/unit-test-results.xml"
);
XmlTransform(
"./tools/NUnitXml.xslt",
"./test-results/unit-test-results.xml",
"./test-results/nunit-unit-test-results.xml"
);
});
// 4. Publish
Task("Publish").Does(() => {
var settings = new DotNetCorePublishSettings {
Framework = "netcoreapp2.0",
Configuration = "Release",
OutputDirectory = "./dist",
VersionSuffix = tag
};
DotNetCorePublish(
"./src/Hello.Harvester/Hello.Harvester.csproj",
settings
);
});
Task("Default")
.IsDependentOn("Restore")
.IsDependentOn("Build")
.IsDependentOn("Unit tests")
.IsDependentOn("Publish");
RunTarget("Default");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment