-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
executable file
·97 lines (77 loc) · 2.79 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.0
#addin Cake.Coveralls
#tool coveralls.io
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var solutionPath = "NServiceBus.Transport.Email.sln";
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
var cleanSettings = new DotNetCoreCleanSettings {
Configuration = configuration
};
DotNetCoreClean(solutionPath, cleanSettings);
});
Task("RestoreNuGetPackages")
.IsDependentOn("Clean")
.Does(() =>
{
DotNetCoreRestore(solutionPath);
});
Task("Build")
.IsDependentOn("RestoreNuGetPackages")
.Does(() =>
{
var buildSettings = new DotNetCoreBuildSettings {
Configuration = configuration,
NoRestore = true,
ArgumentCustomization = arg => arg.AppendSwitch("/p:DebugType","=","Full")
};
DotNetCoreBuild(solutionPath, buildSettings);
});
Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
var testSettings = new DotNetCoreTestSettings {
Configuration = configuration,
NoRestore = true,
NoBuild = true,
Logger = "trx;LogFileName=TestResults.trx",
ArgumentCustomization = args => args.Append("/p:AltCover=true").Append("/p:AltCoverAssemblyExcludeFilter=\"NUnit3.TestAdapter\"")
};
DotNetCoreTest("NServiceBus.Transport.Email.Tests/NServiceBus.Transport.Email.Tests.csproj", testSettings);
});
Task("PublishTestResults")
.IsDependentOn("Test")
.WithCriteria(EnvironmentVariable("APPVEYOR_JOB_ID") != null)
.Does(() =>
{
// Upload tests results
var url = $"https://ci.appveyor.com/api/testresults/mstest/{EnvironmentVariable("APPVEYOR_JOB_ID")}";
UploadFile(url, @"NServiceBus.Transport.Email.Tests/TestResults/TestResults.trx");
// Upload code coverage
CoverallsIo("NServiceBus.Transport.Email.Tests/coverage.xml", new CoverallsIoSettings
{
RepoToken = EnvironmentVariable("APPVEYOR_COVERALLS_TOKEN")
});
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("PublishTestResults");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);