forked from Portkey-Wallet/portkey-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
executable file
·101 lines (93 loc) · 2.91 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
98
99
100
101
#tool nuget:?package=Codecov
#addin nuget:?package=Cake.Codecov&version=0.8.0
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Debug");
var rootPath = "./";
var srcPath = rootPath + "src/";
var contractPath = rootPath + "contract/";
var testPath = rootPath + "test/";
var solution = rootPath + "Portkey.Contracts.sln";
Task("Clean")
.Description("clean up project cache")
.Does(() =>
{
CleanDirectories(srcPath + "**/bin");
CleanDirectories(srcPath + "**/obj");
CleanDirectories(contractPath + "**/bin");
CleanDirectories(contractPath + "**/obj");
CleanDirectories(testPath + "**/bin");
CleanDirectories(testPath + "**/obj");
});
Task("Restore")
.Description("restore project dependencies")
.Does(() =>
{
DotNetCoreRestore(solution, new DotNetCoreRestoreSettings
{
Verbosity = DotNetCoreVerbosity.Quiet,
Sources = new [] { "https://www.myget.org/F/aelf-project-dev/api/v3/index.json", "https://api.nuget.org/v3/index.json" }
});
});
Task("Build")
.Description("Compilation project")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() =>
{
var buildSetting = new DotNetCoreBuildSettings{
NoRestore = true,
Configuration = configuration,
ArgumentCustomization = args => {
return args.Append("/clp:ErrorsOnly")
.Append("-v quiet");}
};
DotNetCoreBuild(solution, buildSetting);
});
Task("Test-with-Codecov")
.Description("operation tes")
.IsDependentOn("Build")
.Does(() =>
{
var testSetting = new DotNetCoreTestSettings{
Configuration = configuration,
NoRestore = true,
NoBuild = true,
ArgumentCustomization = args => {
return args
.Append("--logger trx")
.Append("--settings CodeCoverage.runsettings")
.Append("--collect:\"XPlat Code Coverage\"");
}
};
var testProjects = GetFiles("./test/*.Tests/*.csproj");
var testProjectList = testProjects.OrderBy(p=>p.FullPath).ToList();
foreach(var testProject in testProjectList)
{
DotNetCoreTest(testProject.FullPath, testSetting);
}
});
Task("Run-Unit-Tests")
.Description("operation test")
.IsDependentOn("Build")
.Does(() =>
{
var testSetting = new DotNetCoreTestSettings{
Configuration = configuration,
NoRestore = true,
NoBuild = true,
ArgumentCustomization = args => {
return args.Append("--logger trx");
}
};
var testProjects = GetFiles("./test/*.Tests/*.csproj");
foreach(var testProject in testProjects)
{
DotNetCoreTest(testProject.FullPath, testSetting);
}
});
Task("Upload-Coverage-Azure")
.Does(() =>
{
Codecov("./CodeCoverage/Cobertura.xml","$CODECOV_TOKEN");
});
RunTarget(target);