-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
build.cake
88 lines (72 loc) · 2.94 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
var target = Argument("target", "Pack");
var configuration = Argument("configuration", "Release");
var dotnetRetireProjName = "RetireNet.Packages.Tool";
var dotnetRetirePackageId = "dotnet-retire";
var dotnetRetireProj= $"./src/{dotnetRetireProjName}/{dotnetRetireProjName}.csproj";
var dotnetRetireVersion = "5.0.0";
var dotnetMiddlewareName = "RetireNet.Runtimes.Middleware";
var dotnetMiddlewarePackageId = "RetireNet.Runtimes.Middleware";
var dotnetMiddlewareProj= $"./src/{dotnetMiddlewareName}/{dotnetMiddlewareName}.csproj";
var dotnetBackgroundServiceName = "RetireNet.Runtimes.BackgroundServices";
var dotnetBackgroundServicePackageId = "RetireNet.Runtimes.BackgroundServices";
var dotnetBackgroundServiceProj = $"./src/{dotnetBackgroundServiceName}/{dotnetBackgroundServiceName}.csproj";
var runtimeCheckersVersion = "5.0.0";
var outputDir = "./output";
var sln = "dotnet-retire.sln";
Task("Build")
.Does(() => {
DotNetCoreBuild(sln, new DotNetCoreBuildSettings {
Configuration = "Release" });
});
Task("Test")
.IsDependentOn("Build")
.Does(() => {
var projectFiles = GetFiles("./test/**/*.csproj");
foreach(var file in projectFiles)
{
DotNetCoreTest(file.FullPath, new DotNetCoreTestSettings {
ArgumentCustomization = args=>args.Append("/p:CollectCoverage=true /p:CoverletOutputFormat=opencover")
});
}
});
Task("Pack")
.IsDependentOn("Test")
.Does(() => {
PackIt(dotnetRetireProj, dotnetRetireVersion);
PackIt(dotnetMiddlewareProj, runtimeCheckersVersion);
PackIt(dotnetBackgroundServiceProj, runtimeCheckersVersion);
});
private void PackIt(string project, string version, string tfm = null)
{
var coresettings = new DotNetCorePackSettings
{
Configuration = "Release",
OutputDirectory = outputDir,
NoBuild = true
};
coresettings.MSBuildSettings = new DotNetCoreMSBuildSettings()
.WithProperty("Version", new[] { version });
DotNetCorePack(project, coresettings);
}
Task("PublishTool")
.IsDependentOn("Pack")
.Does(() => {
var settings = new DotNetCoreNuGetPushSettings
{
Source = "https://api.nuget.org/v3/index.json",
ApiKey = EnvironmentVariable("NUGET_API_KEY")
};
DotNetCoreNuGetPush($"{outputDir}/{dotnetRetirePackageId}.{dotnetRetireVersion}.nupkg", settings);
});
Task("PublishRuntimeCheckers")
.IsDependentOn("Pack")
.Does(() => {
var settings = new DotNetCoreNuGetPushSettings
{
Source = "https://api.nuget.org/v3/index.json",
ApiKey = EnvironmentVariable("NUGET_API_KEY")
};
DotNetCoreNuGetPush($"{outputDir}/{dotnetMiddlewarePackageId}.{runtimeCheckersVersion}.nupkg", settings);
DotNetCoreNuGetPush($"{outputDir}/{dotnetBackgroundServicePackageId}.{runtimeCheckersVersion}.nupkg", settings);
});
RunTarget(target);