-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.cake
More file actions
78 lines (67 loc) · 1.98 KB
/
build.cake
File metadata and controls
78 lines (67 loc) · 1.98 KB
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
#addin nuget:?package=Cake.Sonar&version=1.1.32
#tool dotnet:?package=dotnet-sonarscanner&version=5.14.0
var target = Argument("target", "SonarEnd");
var isCI = Argument("mode", "local")=="CI";
var configuration = Argument("configuration", "Release");
var token = Argument("token", "");
var solution = "Cake.DependencyTrack.sln";
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("SonarBegin")
.WithCriteria(isCI)
.Does(() => {
SonarBegin(new SonarBeginSettings{
Key = "saravana1501_cake-dependencytrack",
Name="Cake.DependencyTrack",
Organization="saravana1501",
Url = "https://sonarcloud.io",
Token=token,
OpenCoverReportsPath="./tests/Cake.DependencyTrack.Tests/TestResults/coverage.net6.0.opencover.xml",
UseCoreClr=true,
Exclusions="**/tests/**"
});
});
Task("Build")
.IsDependentOn("SonarBegin")
.Does(() =>
{
DotNetBuild(solution, new DotNetBuildSettings
{
Configuration = configuration,
});
});
Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
DotNetTest(solution, new DotNetTestSettings
{
Configuration = configuration,
NoBuild = true,
ArgumentCustomization = args => args.Append(" -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=opencover")
});
});
Task("Publish")
.IsDependentOn("Test")
.Does(() =>
{
DotNetPublish("./src/Cake.DependencyTrack/Cake.DependencyTrack.csproj", new DotNetPublishSettings {
Configuration = configuration,
OutputDirectory = "./artifact/lib",
Framework = "net6.0"
});
});
Task("SonarEnd")
.WithCriteria(isCI)
.IsDependentOn("Publish")
.Does(() => {
SonarEnd(new SonarEndSettings{
Token=token,
UseCoreClr=true
});
});
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);