forked from BoletoNet/boleto2net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
52 lines (43 loc) · 1.75 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
#addin Cake.Coveralls
#tool "nuget:?package=NUnit.ConsoleRunner"
#tool "nuget:?package=OpenCover"
#tool coveralls.net
using System.Xml.Linq;
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
Task("RunNugetPack").WithCriteria(string.IsNullOrWhiteSpace(EnvironmentVariable("APPVEYOR_PULL_REQUEST_NUMBER"))).Does(() =>
{
DeleteFiles("*.nupkg");
var buildNumber = EnvironmentVariable("appveyor_build_version");
var nuGetPackSettings = new NuGetPackSettings {
Version = $"{buildNumber}",
OutputDirectory = "./"
};
var nuspecFilePath = File("./Boleto2.Net/Boleto2.Net.nuspec");
NuGetPack(nuspecFilePath, nuGetPackSettings);
var nupkg = GetFiles("*.nupkg").First();
});
Task("RunCoverage").IsDependentOn("Build").Does(() =>
{
OpenCover(tool => tool.NUnit3("./**/bin/Release/*.Testes.dll"),
new FilePath("./coverage.xml"),
new OpenCoverSettings().WithFilter("+[*]Boleto2Net.*").WithFilter("-[*]Boleto2Net.Testes.*")
);
CoverallsNet("coverage.xml", CoverallsNetReportType.OpenCover);
});
Task("RunTests").IsDependentOn("Build").Does(() =>
{
var testAssemblies = GetFiles("./**/bin/Release/*.Testes.dll");
NUnit3(testAssemblies, new NUnit3Settings { TeamCity = true });
});
Task("RestorePackages").Does(() =>
{
NuGetRestore(File("Boleto2.Net.sln"), new NuGetRestoreSettings { NoCache = true });
});
Task("Build").IsDependentOn("RestorePackages").Does(() =>
{
MSBuild("Boleto2.Net.sln", config => config.SetVerbosity(Verbosity.Minimal).SetConfiguration(configuration));
});
Task("Default").IsDependentOn("Build").Does(() => {});
Task("CiBuild").IsDependentOn("RunCoverage").IsDependentOn("RunNugetPack").Does(() => {});
RunTarget(target);