Sieve/build/Build.cs

124 lines
3.7 KiB
C#
Raw Normal View History

2021-05-13 14:15:27 +02:00
using System.Linq;
Release Sieve 2.5.0 (#151) * Setup release 2.5.0 with automated build and pre-releases * #80 added support for escaping pipe control characters (#113) * #80 added support for escaping comma and pipe control characters * Update SieveModel.cs Fix build. Accidentally broken by resolving conflicts. * Migrate UnitTests to xUnit Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer13 <kevin@ksommer.eu> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> * SieveProcessor.Options made protected property (#134) Mapper assignment in constructor is moved to a null-coalescing member pair (a field and a property) "IncludeScopes" switch is removed from appSettings.{env}.json files * Revert to _mapper assignment in constructor. (#140) * reverting fix (#142) * Revert to _mapper assignment in constructor. * reverting fix * pass filter values as parameters (#112) make GetClosureOverConstant really work * Make ApplyFiltering, ApplySorting and ApplyPagination protected virtual #139 (#144) * stop excluding null values when filtering using notEqual (#114) * stop excluding null values when filtering using notEqual * add IgnoreNullsOnNotEqual config field, to enable/disable the new feature Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com> Co-authored-by: Clayton Andersen <tunaman65@gmail.com> Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> Co-authored-by: Hasan Manzak <hasan.manzak@gmail.com> Co-authored-by: alicak <alicak@users.noreply.github.com> Co-authored-by: AnasZakarneh <Zakarnehanas1@gmail.com> Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com>
2021-08-29 16:30:19 +02:00
using GlobExpressions;
2021-05-13 14:15:27 +02:00
using Nuke.Common;
using Nuke.Common.CI;
2021-05-13 14:37:43 +02:00
using Nuke.Common.CI.GitHubActions;
2021-05-13 14:15:27 +02:00
using Nuke.Common.Execution;
using Nuke.Common.Git;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.GitVersion;
Release Sieve 2.5.0 (#151) * Setup release 2.5.0 with automated build and pre-releases * #80 added support for escaping pipe control characters (#113) * #80 added support for escaping comma and pipe control characters * Update SieveModel.cs Fix build. Accidentally broken by resolving conflicts. * Migrate UnitTests to xUnit Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer13 <kevin@ksommer.eu> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> * SieveProcessor.Options made protected property (#134) Mapper assignment in constructor is moved to a null-coalescing member pair (a field and a property) "IncludeScopes" switch is removed from appSettings.{env}.json files * Revert to _mapper assignment in constructor. (#140) * reverting fix (#142) * Revert to _mapper assignment in constructor. * reverting fix * pass filter values as parameters (#112) make GetClosureOverConstant really work * Make ApplyFiltering, ApplySorting and ApplyPagination protected virtual #139 (#144) * stop excluding null values when filtering using notEqual (#114) * stop excluding null values when filtering using notEqual * add IgnoreNullsOnNotEqual config field, to enable/disable the new feature Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com> Co-authored-by: Clayton Andersen <tunaman65@gmail.com> Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> Co-authored-by: Hasan Manzak <hasan.manzak@gmail.com> Co-authored-by: alicak <alicak@users.noreply.github.com> Co-authored-by: AnasZakarneh <Zakarnehanas1@gmail.com> Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com>
2021-08-29 16:30:19 +02:00
using Nuke.Common.Utilities.Collections;
2021-05-13 14:15:27 +02:00
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
[CheckBuildProjectConfigurations]
[ShutdownDotNetAfterServerBuild]
2021-05-13 14:37:43 +02:00
[GitHubActions("ci", GitHubActionsImage.UbuntuLatest,
Release Sieve 2.5.0 (#151) * Setup release 2.5.0 with automated build and pre-releases * #80 added support for escaping pipe control characters (#113) * #80 added support for escaping comma and pipe control characters * Update SieveModel.cs Fix build. Accidentally broken by resolving conflicts. * Migrate UnitTests to xUnit Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer13 <kevin@ksommer.eu> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> * SieveProcessor.Options made protected property (#134) Mapper assignment in constructor is moved to a null-coalescing member pair (a field and a property) "IncludeScopes" switch is removed from appSettings.{env}.json files * Revert to _mapper assignment in constructor. (#140) * reverting fix (#142) * Revert to _mapper assignment in constructor. * reverting fix * pass filter values as parameters (#112) make GetClosureOverConstant really work * Make ApplyFiltering, ApplySorting and ApplyPagination protected virtual #139 (#144) * stop excluding null values when filtering using notEqual (#114) * stop excluding null values when filtering using notEqual * add IgnoreNullsOnNotEqual config field, to enable/disable the new feature Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com> Co-authored-by: Clayton Andersen <tunaman65@gmail.com> Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> Co-authored-by: Hasan Manzak <hasan.manzak@gmail.com> Co-authored-by: alicak <alicak@users.noreply.github.com> Co-authored-by: AnasZakarneh <Zakarnehanas1@gmail.com> Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com>
2021-08-29 16:30:19 +02:00
OnPullRequestBranches = new[] {"master", "releases/*"},
2021-05-13 14:37:43 +02:00
AutoGenerate = true,
InvokedTargets = new[] {nameof(Ci)},
2021-05-13 14:37:43 +02:00
CacheKeyFiles = new string[0])]
Release Sieve 2.5.0 (#151) * Setup release 2.5.0 with automated build and pre-releases * #80 added support for escaping pipe control characters (#113) * #80 added support for escaping comma and pipe control characters * Update SieveModel.cs Fix build. Accidentally broken by resolving conflicts. * Migrate UnitTests to xUnit Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer13 <kevin@ksommer.eu> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> * SieveProcessor.Options made protected property (#134) Mapper assignment in constructor is moved to a null-coalescing member pair (a field and a property) "IncludeScopes" switch is removed from appSettings.{env}.json files * Revert to _mapper assignment in constructor. (#140) * reverting fix (#142) * Revert to _mapper assignment in constructor. * reverting fix * pass filter values as parameters (#112) make GetClosureOverConstant really work * Make ApplyFiltering, ApplySorting and ApplyPagination protected virtual #139 (#144) * stop excluding null values when filtering using notEqual (#114) * stop excluding null values when filtering using notEqual * add IgnoreNullsOnNotEqual config field, to enable/disable the new feature Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com> Co-authored-by: Clayton Andersen <tunaman65@gmail.com> Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> Co-authored-by: Hasan Manzak <hasan.manzak@gmail.com> Co-authored-by: alicak <alicak@users.noreply.github.com> Co-authored-by: AnasZakarneh <Zakarnehanas1@gmail.com> Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com>
2021-08-29 16:30:19 +02:00
[GitHubActions("ci_publish", GitHubActionsImage.UbuntuLatest,
OnPushBranches = new[] { "releases/*" },
OnPushTags = new[] { "v*" },
Release Sieve 2.5.0 (#151) * Setup release 2.5.0 with automated build and pre-releases * #80 added support for escaping pipe control characters (#113) * #80 added support for escaping comma and pipe control characters * Update SieveModel.cs Fix build. Accidentally broken by resolving conflicts. * Migrate UnitTests to xUnit Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer13 <kevin@ksommer.eu> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> * SieveProcessor.Options made protected property (#134) Mapper assignment in constructor is moved to a null-coalescing member pair (a field and a property) "IncludeScopes" switch is removed from appSettings.{env}.json files * Revert to _mapper assignment in constructor. (#140) * reverting fix (#142) * Revert to _mapper assignment in constructor. * reverting fix * pass filter values as parameters (#112) make GetClosureOverConstant really work * Make ApplyFiltering, ApplySorting and ApplyPagination protected virtual #139 (#144) * stop excluding null values when filtering using notEqual (#114) * stop excluding null values when filtering using notEqual * add IgnoreNullsOnNotEqual config field, to enable/disable the new feature Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com> Co-authored-by: Clayton Andersen <tunaman65@gmail.com> Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> Co-authored-by: Hasan Manzak <hasan.manzak@gmail.com> Co-authored-by: alicak <alicak@users.noreply.github.com> Co-authored-by: AnasZakarneh <Zakarnehanas1@gmail.com> Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com>
2021-08-29 16:30:19 +02:00
AutoGenerate = true,
InvokedTargets = new[] {nameof(CiPublish)},
CacheKeyFiles = new string[0],
ImportSecrets = new[] {"NUGET_API_KEY"})]
2021-05-13 14:15:27 +02:00
class Build : NukeBuild
{
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
2021-05-13 14:37:43 +02:00
[GitRepository] readonly GitRepository GitRepository;
2021-05-13 14:15:27 +02:00
2021-05-13 14:37:43 +02:00
[GitVersion(Framework = "netcoreapp3.1")] readonly GitVersion GitVersion;
2021-05-13 14:15:27 +02:00
[Solution] readonly Solution Solution;
Release Sieve 2.5.0 (#151) * Setup release 2.5.0 with automated build and pre-releases * #80 added support for escaping pipe control characters (#113) * #80 added support for escaping comma and pipe control characters * Update SieveModel.cs Fix build. Accidentally broken by resolving conflicts. * Migrate UnitTests to xUnit Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer13 <kevin@ksommer.eu> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> * SieveProcessor.Options made protected property (#134) Mapper assignment in constructor is moved to a null-coalescing member pair (a field and a property) "IncludeScopes" switch is removed from appSettings.{env}.json files * Revert to _mapper assignment in constructor. (#140) * reverting fix (#142) * Revert to _mapper assignment in constructor. * reverting fix * pass filter values as parameters (#112) make GetClosureOverConstant really work * Make ApplyFiltering, ApplySorting and ApplyPagination protected virtual #139 (#144) * stop excluding null values when filtering using notEqual (#114) * stop excluding null values when filtering using notEqual * add IgnoreNullsOnNotEqual config field, to enable/disable the new feature Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com> Co-authored-by: Clayton Andersen <tunaman65@gmail.com> Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> Co-authored-by: Hasan Manzak <hasan.manzak@gmail.com> Co-authored-by: alicak <alicak@users.noreply.github.com> Co-authored-by: AnasZakarneh <Zakarnehanas1@gmail.com> Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com>
2021-08-29 16:30:19 +02:00
// ReSharper disable once InconsistentNaming
[Parameter] string NUGET_API_KEY;
Project SieveProject => Solution.AllProjects.First(p => p.Name == "Sieve");
2021-05-13 14:15:27 +02:00
AbsolutePath OutputDirectory => RootDirectory / "output";
Target Clean => _ => _
.Executes(() =>
{
DotNetClean();
EnsureCleanDirectory(OutputDirectory);
});
Target Restore => _ => _
.DependsOn(Clean)
.Executes(() =>
{
DotNetRestore(s => s
.SetProjectFile(Solution));
});
Target Compile => _ => _
.DependsOn(Restore)
.Executes(() =>
{
DotNetBuild(s => s
.SetProjectFile(Solution)
.SetConfiguration(Configuration)
.SetAssemblyVersion(GitVersion.AssemblySemVer)
.SetFileVersion(GitVersion.AssemblySemFileVer)
.SetInformationalVersion(GitVersion.InformationalVersion)
.EnableNoRestore());
});
Target Test => _ => _
.DependsOn(Compile)
.Executes(() =>
{
DotNetTest(s => s
.SetProjectFile(Solution));
2021-05-13 14:15:27 +02:00
});
Target Package => _ => _
.DependsOn(Test)
.Executes(() =>
2021-05-13 14:15:27 +02:00
{
DotNetPack(s => s
.SetProject(SieveProject)
.SetConfiguration(Configuration)
.SetOutputDirectory(OutputDirectory)
.SetVersion(GitVersion.NuGetVersionV2)
.EnableNoRestore()
.EnableNoBuild());
});
Release Sieve 2.5.0 (#151) * Setup release 2.5.0 with automated build and pre-releases * #80 added support for escaping pipe control characters (#113) * #80 added support for escaping comma and pipe control characters * Update SieveModel.cs Fix build. Accidentally broken by resolving conflicts. * Migrate UnitTests to xUnit Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer13 <kevin@ksommer.eu> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> * SieveProcessor.Options made protected property (#134) Mapper assignment in constructor is moved to a null-coalescing member pair (a field and a property) "IncludeScopes" switch is removed from appSettings.{env}.json files * Revert to _mapper assignment in constructor. (#140) * reverting fix (#142) * Revert to _mapper assignment in constructor. * reverting fix * pass filter values as parameters (#112) make GetClosureOverConstant really work * Make ApplyFiltering, ApplySorting and ApplyPagination protected virtual #139 (#144) * stop excluding null values when filtering using notEqual (#114) * stop excluding null values when filtering using notEqual * add IgnoreNullsOnNotEqual config field, to enable/disable the new feature Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com> Co-authored-by: Clayton Andersen <tunaman65@gmail.com> Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> Co-authored-by: Hasan Manzak <hasan.manzak@gmail.com> Co-authored-by: alicak <alicak@users.noreply.github.com> Co-authored-by: AnasZakarneh <Zakarnehanas1@gmail.com> Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com>
2021-08-29 16:30:19 +02:00
Target Publish => _ => _
.DependsOn(Package)
.Requires(() => IsServerBuild)
.Requires(() => NUGET_API_KEY)
.Requires(() => Configuration.Equals(Configuration.Release))
.Executes(() =>
{
Glob.Files(OutputDirectory, "*.nupkg")
.NotEmpty()
.ForEach(x =>
{
DotNetNuGetPush(s => s
.SetTargetPath(OutputDirectory / x)
.SetSource("https://api.nuget.org/v3/index.json")
.SetApiKey(NUGET_API_KEY));
});
});
2021-05-13 14:15:27 +02:00
Target Ci => _ => _
Release Sieve 2.5.0 (#151) * Setup release 2.5.0 with automated build and pre-releases * #80 added support for escaping pipe control characters (#113) * #80 added support for escaping comma and pipe control characters * Update SieveModel.cs Fix build. Accidentally broken by resolving conflicts. * Migrate UnitTests to xUnit Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer13 <kevin@ksommer.eu> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> * SieveProcessor.Options made protected property (#134) Mapper assignment in constructor is moved to a null-coalescing member pair (a field and a property) "IncludeScopes" switch is removed from appSettings.{env}.json files * Revert to _mapper assignment in constructor. (#140) * reverting fix (#142) * Revert to _mapper assignment in constructor. * reverting fix * pass filter values as parameters (#112) make GetClosureOverConstant really work * Make ApplyFiltering, ApplySorting and ApplyPagination protected virtual #139 (#144) * stop excluding null values when filtering using notEqual (#114) * stop excluding null values when filtering using notEqual * add IgnoreNullsOnNotEqual config field, to enable/disable the new feature Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com> Co-authored-by: Clayton Andersen <tunaman65@gmail.com> Co-authored-by: Clayton Andersen <candersen@restaurant365.com> Co-authored-by: ITDancer139 <kevinitdancersommer@gmail.com> Co-authored-by: Hasan Manzak <hasan.manzak@gmail.com> Co-authored-by: alicak <alicak@users.noreply.github.com> Co-authored-by: AnasZakarneh <Zakarnehanas1@gmail.com> Co-authored-by: AnasZakarneh <a.zakarneh@foothillsolutions.com>
2021-08-29 16:30:19 +02:00
.DependsOn(Test);
Target CiPublish => _ => _
.DependsOn(Publish);
public static int Main() => Execute<Build>(x => x.Package);
2021-05-13 14:15:27 +02:00
}