-
Notifications
You must be signed in to change notification settings - Fork 1
/
default.cake
69 lines (57 loc) · 1.97 KB
/
default.cake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#tool "nuget:?package=Cake.CoreCLR";
#addin "Cake.Json";
#addin "Cake.FileHelpers";
#addin "Newtonsoft.Json";
#load "./cake/all.cake";
//Arguments
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var artifacts = (DirectoryPath)Argument("artifacts", "./artifacts");
//Constants
//Gather configuration into single object here. Any variables used across tasks should be gathered here
// to minimize code duplication and bad hand-offs across tasks
var Config = new {
Version = new {
Full = BuildVersion.Full,
Semantic = BuildVersion.Semantic
},
Projects = new {
DockerProxy = new FilePath("./DockerProxy/DockerProxy.csproj"),
UnitTests = GetFiles("./**/*.UnitTests.csproj")
},
Artifacts = artifacts
};
Task("Default")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependentOn("Package");
Task("Build")
.Does(() => {
//Build Docker Proxy
DotNetRestore(Config.Projects.DockerProxy.GetDirectory());
DotNetBuild(Config.Projects.DockerProxy.GetDirectory(), Config.Version.Full, configuration);
});
Task("Test")
.Does(() => {
//Run all UnitTests
foreach(var projectFile in Config.Projects.UnitTests) {
DotNetRestore(projectFile.GetDirectory());
DotNetTest(projectFile.GetDirectory(), configuration);
}
});
Task("Package")
.Does(() => {
//Build/Publish DotNet artifacts, build Docker image
var artifactPath = System.IO.Path.GetFullPath(Config.Artifacts + "/DockerProxy-" + Config.Version.Semantic);
DotNetPublish(Config.Projects.DockerProxy.GetDirectory(), artifactPath, Config.Version.Full, configuration);
});
Task("Publish")
.Does(() => {
});
// DEVELOPER ENVIRONMENT TASKS
Task("Run")
.Does(() => {
DotNetRestore(Config.Projects.DockerProxy.GetDirectory());
DotNetRun(Config.Projects.DockerProxy.GetDirectory());
});
RunTarget(target);