-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.cake
More file actions
136 lines (122 loc) Β· 5.32 KB
/
build.cake
File metadata and controls
136 lines (122 loc) Β· 5.32 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
var target = Argument("Target", "Default");
var configuration =
HasArgument("Configuration") ? Argument<string>("Configuration") :
EnvironmentVariable("Configuration", "Release");
var artifactsDirectory = Directory("./Artifacts");
Task("Clean")
.Description("Cleans the artifacts, bin and obj directories.")
.Does(() =>
{
CleanDirectory(artifactsDirectory);
DeleteDirectories(GetDirectories("**/bin"), new DeleteDirectorySettings() { Force = true, Recursive = true });
DeleteDirectories(GetDirectories("**/obj"), new DeleteDirectorySettings() { Force = true, Recursive = true });
});
Task("Restore")
.Description("Restores NuGet packages.")
.IsDependentOn("Clean")
.Does(() =>
{
DotNetRestore();
});
Task("Build")
.Description("Builds the solution.")
.IsDependentOn("Restore")
.Does(() =>
{
DotNetBuild(
".",
new DotNetBuildSettings()
{
Configuration = configuration,
NoRestore = true,
});
});
Task("Test")
.Description("Runs unit tests and outputs test results to the artifacts directory.")
.DoesForEach(GetFiles("./test/**/*.Tests.csproj"), project =>
{
Information($"Preparing {project.GetFilename()} for test");
var settings = new DotNetTestSettings()
{
Blame = true,
Collectors = new string[] { "XPlat Code Coverage" },
Configuration = configuration,
Loggers = new string[]
{
$"trx;LogFileName={project.GetFilenameWithoutExtension()}.trx",
$"html;LogFileName={project.GetFilenameWithoutExtension()}.html",
},
NoBuild = true,
NoRestore = true,
ResultsDirectory = $"{artifactsDirectory}/TestResults",
Settings = "CodeCoverage.runsettings"
};
// Platform-specific intrinsics testing
if (IsRunningOnUnix())
{
// ARM/Mac testing with AdvSIMD
settings.EnvironmentVariables["COMPlus_EnableAdvSimd"] = "1";
settings.ResultsDirectory = $"{artifactsDirectory}/TestResults/AdvSimd";
Information($"Running default {project.GetFilename()} test with ARM AdvSIMD enabled");
DotNetTest(project.ToString(), settings);
settings.EnvironmentVariables["COMPlus_EnableAdvSimd"] = "0";
settings.ResultsDirectory = $"{artifactsDirectory}/TestResults/Scalar";
Information($"Running {project.GetFilename()} test with ARM AdvSIMD disabled (scalar only)");
DotNetTest(project.ToString(), settings);
}
else
{
// x86/x64 testing with AVX2/SSE3
settings.EnvironmentVariables["COMPlus_EnableAVX2"] = "1";
settings.EnvironmentVariables["COMPlus_EnableSSE3"] = "1";
settings.ResultsDirectory = $"{artifactsDirectory}/TestResults/Avx2";
Information($"Running default {project.GetFilename()} test with SSE3 and AVX2 enabled");
DotNetTest(project.ToString(), settings);
settings.EnvironmentVariables["COMPlus_EnableAVX2"] = "0";
settings.EnvironmentVariables["COMPlus_EnableSSE3"] = "1";
settings.ResultsDirectory = $"{artifactsDirectory}/TestResults/Sse3";
Information($"Running {project.GetFilename()} test with SSE3 enabled and AVX2 disabled");
DotNetTest(project.ToString(), settings);
settings.EnvironmentVariables["COMPlus_EnableAVX2"] = "0";
settings.EnvironmentVariables["COMPlus_EnableSSE3"] = "0";
settings.ResultsDirectory = $"{artifactsDirectory}/TestResults/Scalar";
Information($"Running {project.GetFilename()} test with SSE3 and AVX2 disabled");
DotNetTest(project.ToString(), settings);
}
});
Task("CoverageReport")
.IsDependentOn("Test")
.Does(() =>
{
ReportGenerator(report: $"{artifactsDirectory}/TestResults/**/coverage.cobertura.xml",
targetDir: new DirectoryPath($"{artifactsDirectory}/TestResults/Coverage/Reports"),
settings: new ReportGeneratorSettings
{
ArgumentCustomization = args => args.Append("-reporttypes:HtmlInline;HTMLChart;Cobertura")
});
});
Task("Pack")
.Description("Creates the NuGet packages and outputs them to the artifacts directory.")
.Does(() =>
{
DotNetPack(
"./src/NaCl.Core/",
new DotNetPackSettings()
{
Configuration = configuration,
IncludeSymbols = false,
MSBuildSettings = new DotNetMSBuildSettings()
{
ContinuousIntegrationBuild = !BuildSystem.IsLocalBuild,
},
NoBuild = true,
NoRestore = true,
OutputDirectory = artifactsDirectory,
});
});
Task("Default")
.Description("Cleans, restores, builds the solution, runs unit tests and then create the NuGet packages.")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependentOn("Pack");
RunTarget(target);