-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.cake
56 lines (48 loc) · 1.39 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
#tool "nuget:?package=NUnit.ConsoleRunner"
#tool nuget:?package=MSBuild.SonarQube.Runner.Tool
#tool "nuget:?package=OpenCover"
#addin nuget:?package=Cake.Sonar
var sonarAuthKey = Argument("SonarAuthKey", "");
Task("RestorePackages")
.Does(() => {
NuGetRestore("Crawler.sln");
});
Task("Compile")
.IsDependentOn("RestorePackages")
.Does(() => {
MSBuild("Crawler.sln", new MSBuildSettings { Configuration = "Debug" });
});
Task("RunTests")
.Does(() => {
OpenCover(tool => {
tool.NUnit3("./Bin/*.Tests.dll");
},
new FilePath("openCoverResult.xml"),
new OpenCoverSettings()
.WithFilter("+[Crawler.Logics]*")
.WithFilter("-[Crawler.Tests]*"));
});
Task("SonarBegin")
.Does(() => {
SonarBegin(new SonarBeginSettings{
Url = "https://sonarcloud.io/",
Key = "Crawler.Example",
Name = "CrawlerExample",
Verbose = true,
Login = sonarAuthKey,
Organization = "sergeyo",
OpenCoverReportsPath = "openCoverResult.xml"
});
});
Task("SonarEnd")
.Does(() => {
SonarEnd(new SonarEndSettings{
Login = sonarAuthKey
});
});
Task("RunTestsWithSonar")
.IsDependentOn("SonarBegin")
.IsDependentOn("Compile")
.IsDependentOn("RunTests")
.IsDependentOn("SonarEnd");
RunTarget("RunTestsWithSonar");