This repository has been archived by the owner on Sep 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
103 lines (91 loc) · 3.27 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
#load "./buildconfig.cake"
var config = BuildConfig.Create(Context, BuildSystem);
var verbosity = DotNetCoreVerbosity.Minimal;
Information($"SrcDir: '{config.SrcDir}'");
Information($"ArtifactsDir: '{config.ArtifactsDir}'");
Information($"SemVer: '{config.SemVer}'");
Information($"BuildVersion: '{config.BuildVersion}'");
Information($"BuildProfile: '{config.BuildProfile}'");
Task("Default")
.IsDependentOn("Clean")
.IsDependentOn("Build")
.IsDependentOn("UnitTests")
.IsDependentOn("IntegrationTests");
Task("CI")
.IsDependentOn("Docker-Compose-Up")
.IsDependentOn("Default")
.IsDependentOn("Pack")
.Finally(() => {
Information("Running 'docker-compose down'...");
StartProcess("docker-compose", "down");
});
/********************************************/
Task("Clean").Does(() => {
EnsureDirectoryExists(config.ArtifactsDir);
CleanDirectory(config.ArtifactsDir);
});
Task("Build").Does(() => {
var settings = new DotNetCoreBuildSettings {
Configuration = config.BuildProfile,
NoIncremental = true,
NoRestore = false,
Verbosity = verbosity,
MSBuildSettings = new DotNetCoreMSBuildSettings()
.WithProperty("TreatWarningsAsErrors", "true")
.WithProperty("Version", config.SemVer)
.WithProperty("AssemblyVersion", config.BuildVersion)
.WithProperty("FileVersion", config.BuildVersion)
.WithProperty("InformationalVersion", config.BuildVersion)
};
foreach(var sln in GetFiles($"{config.SrcDir}*.sln")) {
DotNetCoreBuild(sln.FullPath, settings);
}
});
Task("UnitTests").Does(() => {
var settings = new DotNetCoreTestSettings {
Configuration = config.BuildProfile,
NoBuild = true,
NoRestore = true,
Logger = "trx",
ResultsDirectory = config.TestResultsDir,
Verbosity = verbosity
};
foreach(var testProj in GetFiles($"{config.SrcDir}tests/**/UnitTests.fsproj")) {
DotNetCoreTest(testProj.FullPath, settings);
}
});
Task("Docker-Compose-Up").Does(() => {
StartProcess("docker-compose", "up -d");
});
Task("IntegrationTests").Does(() => {
var settings = new DotNetCoreTestSettings {
Configuration = config.BuildProfile,
NoBuild = true,
NoRestore = true,
Logger = "trx",
ResultsDirectory = config.TestResultsDir,
Verbosity = verbosity
};
foreach(var testProj in GetFiles($"{config.SrcDir}tests/**/IntegrationTests.fsproj")) {
DotNetCoreTest(testProj.FullPath, settings);
}
});
Task("Pack").Does(() => {
var settings = new DotNetCorePackSettings
{
Configuration = config.BuildProfile,
OutputDirectory = config.ArtifactsDir,
NoRestore = true,
NoBuild = true,
Verbosity = verbosity,
MSBuildSettings = new DotNetCoreMSBuildSettings()
.WithProperty("Version", config.SemVer)
.WithProperty("AssemblyVersion", config.BuildVersion)
.WithProperty("FileVersion", config.BuildVersion)
.WithProperty("InformationalVersion", config.BuildVersion)
};
foreach(var proj in GetFiles($"{config.SrcDir}projects/**/*.fsproj")) {
DotNetCorePack(proj.FullPath, settings);
}
});
RunTarget(config.Target);