-
Notifications
You must be signed in to change notification settings - Fork 100
/
build.cake
106 lines (88 loc) · 2.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
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
#addin nuget:?package=Cake.Figlet&version=1.3.1
#addin nuget:?package=Cake.GitPackager&version=0.1.3.2
#addin nuget:?package=Cake.Git&version=0.22.0
#addin nuget:?package=Cake.FileHelpers&version=3.3.0
#tool nuget:?package=docfx.console&version=2.51.0
// Default MSBuild configuration arguments
var configuration = Argument("configuration", "Release");
Task("Clean")
.Does(() =>
{
CleanDirectory("./artifacts/");
GetDirectories("./src/**/bin")
.ToList()
.ForEach(d => CleanDirectory(d));
GetDirectories("./src/**/obj")
.ToList()
.ForEach(d => CleanDirectory(d));
});
Task("Restore")
.Does(() =>
{
DotNetCoreRestore("./src/Okta.Sdk.sln");
});
Task("Build")
.IsDependentOn("Restore")
.Does(() =>
{
var projects = GetFiles("./src/**/*.csproj");
Console.WriteLine("Building {0} projects", projects.Count());
foreach (var project in projects)
{
Console.WriteLine("Building project ", project.GetFilenameWithoutExtension());
DotNetCoreBuild(project.FullPath, new DotNetCoreBuildSettings
{
Configuration = configuration
});
}
});
Task("Pack")
.IsDependentOn("Build")
.Does(() =>
{
DotNetCorePack("./src/Okta.Sdk/Okta.Sdk.csproj", new DotNetCorePackSettings
{
Configuration = configuration,
OutputDirectory = "./artifacts/"
});
});
Task("Test")
.IsDependentOn("Restore")
.IsDependentOn("Build")
.Does(() =>
{
var testProjects = new[] { "Okta.Sdk.UnitTest" };
// For now, we won't run integration tests in CI
foreach (var name in testProjects)
{
DotNetCoreTest(string.Format("./src/{0}/{0}.csproj", name));
}
});
Task("IntegrationTest")
.IsDependentOn("Restore")
.IsDependentOn("Build")
.Does(() =>
{
var testProjects = new[] { "Okta.Sdk.IntegrationTest" };
// Run integration tests in nightly travis cron job
foreach (var name in testProjects)
{
DotNetCoreTest(string.Format("./src/{0}/{0}.csproj", name));
}
});
// Define top-level tasks
Task("Default")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependentOn("Pack");
Task("DefaultIT")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.IsDependentOn("Build")
.IsDependentOn("IntegrationTest")
.IsDependentOn("Pack");
// Default task
var target = Argument("target", "Default");
RunTarget(target);