This repository has been archived by the owner on Jun 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.cake
76 lines (65 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
76
#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.1
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var version = AppVeyor.IsRunningOnAppVeyor ? AppVeyor.Environment.Build.Version : "0.0.1";
var releaseBinPath = "./DynamoDbAutoScaler/bin/Release";
var artifactsDirectory = "./artifacts";
Task("Restore-NuGet-Packages")
.Does(() => {
NuGetRestore("./DynamoDbAutoscaler.sln");
});
Task("Setup")
.Does(() => {
CreateDirectory(artifactsDirectory);
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() => {
MSBuild("./DynamoDbAutoscaler.sln", settings =>
settings.SetConfiguration(configuration));
});
Task("UnitTest")
.IsDependentOn("Build")
.IsDependentOn("Setup")
.Does(() => {
var resultsFile = artifactsDirectory + "/NUnitResults.xml";
NUnit3("./DynamoDbAutoscaler.Test/bin/Release/DynamoDbAutoscaler.Test.dll", new NUnit3Settings()
{
Results = resultsFile,
});
if(AppVeyor.IsRunningOnAppVeyor)
{
AppVeyor.UploadTestResults(resultsFile, AppVeyorTestResultsType.NUnit3);
}
});
Task("Pack")
.IsDependentOn("Build")
.IsDependentOn("Setup")
.Does(() => {
NuGetPack("./DynamoDbAutoScaler/DynamoDbAutoscaler.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);