-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.cake
75 lines (63 loc) · 1.82 KB
/
build.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
70
71
72
73
74
75
#tool nuget:?package=NUnit.ConsoleRunner&version=3.5.0
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var version = AppVeyor.IsRunningOnAppVeyor ? AppVeyor.Environment.Build.Version : "0.0.1";
var releaseBinPath = "./StatusPageIo/StatusPageIo.Api/bin/Release";
var artifactsDirectory = "./artifacts";
Task("Restore-NuGet-Packages")
.Does(() => {
NuGetRestore("./StatusPageIo.sln");
});
Task("Setup")
.Does(() => {
CreateDirectory(artifactsDirectory);
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() => {
MSBuild("./StatusPageIo.sln", settings =>
settings.SetConfiguration(configuration));
});
Task("UnitTest")
.IsDependentOn("Build")
.IsDependentOn("Setup")
.Does(() => {
var settings = new NUnit3Settings();
settings.NoResults = false;
NUnit3("./StatusPageIo/StatusPageIo.UnitTests/bin/Release/StatusPageIo.UnitTests.dll", settings);
if(AppVeyor.IsRunningOnAppVeyor)
{
AppVeyor.UploadTestResults("./TestResult.xml", AppVeyorTestResultsType.NUnit3);
}
});
Task("Pack")
.IsDependentOn("Build")
.IsDependentOn("Setup")
.Does(() => {
NuGetPack("./StatusPageIo/StatusPageIo.Api/StatusPageIo.Api.nuspec", new NuGetPackSettings()
{
Version = version,
ArgumentCustomization = args => args.Append("-Prop Configuration=" + configuration),
BasePath = releaseBinPath,
OutputDirectory = artifactsDirectory,
});
});
Task("UploadNugetPackages")
.IsDependentOn("Pack")
.Does(() => {
if(!AppVeyor.IsRunningOnAppVeyor)
{
return;
}
var files = GetFiles(artifactsDirectory + "/*.nupkg");
foreach(var file in files)
{
AppVeyor.UploadArtifact(file);
}
});
Task("Default")
.IsDependentOn("Build")
.IsDependentOn("UnitTest")
.IsDependentOn("Pack")
.IsDependentOn("UploadNugetPackages");
RunTarget(target);