-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75f1bfe
commit 9f42792
Showing
4 changed files
with
93 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,94 @@ | ||
using System; | ||
using Serilog; | ||
using System.Linq; | ||
using Nuke.Common; | ||
using Nuke.Common.CI; | ||
using Nuke.Common.Execution; | ||
using Nuke.Common.IO; | ||
using Nuke.Common.ProjectModel; | ||
using Nuke.Common.Tooling; | ||
using Nuke.Common.Utilities.Collections; | ||
using Nuke.Common.Tools.Coverlet; | ||
using Nuke.Common.Tools.DotNet; | ||
using Nuke.Common.Tools.GitVersion; | ||
using Nuke.Common.Tools.NuGet; | ||
using static Nuke.Common.EnvironmentInfo; | ||
using static Nuke.Common.IO.FileSystemTasks; | ||
using static Nuke.Common.IO.PathConstruction; | ||
using static Nuke.Common.Tools.DotNet.DotNetTasks; | ||
using static Nuke.Common.Tools.NuGet.NuGetTasks; | ||
using static Nuke.Common.Tools.NuGet.NuGetPackSettingsExtensions; | ||
using Nuke.Common.IO; | ||
using Nuke.Common.Utilities.Collections; | ||
|
||
class Build : NukeBuild | ||
{ | ||
/// Support plugins are available for: | ||
/// - JetBrains ReSharper https://nuke.build/resharper | ||
/// - JetBrains Rider https://nuke.build/rider | ||
/// - Microsoft VisualStudio https://nuke.build/visualstudio | ||
/// - Microsoft VSCode https://nuke.build/vscode | ||
|
||
public static int Main () => Execute<Build>(x => x.Compile); | ||
public static int Main() => Execute<Build>(x => x.RunUnitTests); | ||
|
||
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] | ||
[Parameter] | ||
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release; | ||
|
||
[Solution] | ||
readonly Solution Solution; | ||
|
||
[Parameter] | ||
AbsolutePath TestResultDirectory = RootDirectory + "/Artifacts/Test-Results/"; | ||
|
||
Target Information => _ => _ | ||
.Before(Preparation) | ||
.Executes(() => | ||
{ | ||
Log.Information($"Solution path : {Solution}"); | ||
Log.Information($"Solution directory : {Solution.Directory}"); | ||
Log.Information($"Configuration : {Configuration}"); | ||
Log.Information($"TestResultDirectory : {TestResultDirectory}"); | ||
}); | ||
|
||
Target Preparation => _ => _ | ||
.DependsOn(Information) | ||
.Executes(() => | ||
{ | ||
TestResultDirectory.CreateOrCleanDirectory(); | ||
}); | ||
|
||
Target Clean => _ => _ | ||
.Before(Restore) | ||
.DependsOn(Preparation) | ||
.Executes(() => | ||
{ | ||
DotNetClean(); | ||
}); | ||
|
||
Target Restore => _ => _ | ||
.DependsOn(Clean) | ||
.Executes(() => | ||
{ | ||
DotNetRestore(a => a.SetProjectFile(Solution)); | ||
}); | ||
|
||
Target Compile => _ => _ | ||
.DependsOn(Restore) | ||
.Executes(() => | ||
{ | ||
DotNetBuild(a => | ||
a.SetProjectFile(Solution) | ||
.SetNoRestore(true) | ||
.SetConfiguration(Configuration)); | ||
}); | ||
|
||
Target RunUnitTests => _ => _ | ||
.DependsOn(Compile) | ||
.Executes(() => | ||
{ | ||
var testProjects = Solution.AllProjects.Where(s => s.Name.EndsWith("Tests.Unit")); | ||
|
||
DotNetTest(a => a | ||
.SetConfiguration(Configuration) | ||
.SetNoBuild(true) | ||
.SetNoRestore(true) | ||
.ResetVerbosity() | ||
.SetResultsDirectory(TestResultDirectory) | ||
.EnableCollectCoverage() | ||
.SetCoverletOutputFormat(CoverletOutputFormat.opencover) | ||
.SetExcludeByFile("*.Generated.cs") | ||
.EnableUseSourceLink() | ||
.CombineWith(testProjects, (b, z) => b | ||
.SetProjectFile(z) | ||
.AddLoggers($"trx;LogFileName={z.Name}.trx") | ||
.SetCoverletOutput(TestResultDirectory + $"{z.Name}.xml"))); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<RootNamespace></RootNamespace> | ||
<NoWarn>CS0649;CS0169;CA1050;CA1822;CA2211;IDE1006</NoWarn> | ||
<NukeRootDirectory>..\..</NukeRootDirectory> | ||
<NukeScriptDirectory>..\..</NukeScriptDirectory> | ||
<NukeTelemetryVersion>1</NukeTelemetryVersion> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<AssemblyName>TaskoMask.Build</AssemblyName> | ||
<RootNamespace>TaskoMask.Build</RootNamespace> | ||
<NoWarn>CS0649;CS0169;CA1050;CA1822;CA2211;IDE1006</NoWarn> | ||
<NukeTelemetryVersion>1</NukeTelemetryVersion> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Nuke.Common" Version="7.0.6" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Nuke.Common" Version="7.0.6" /> | ||
<PackageReference Include="Serilog" Version="3.0.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |