Skip to content

Commit

Permalink
Allow specifying the build configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisdoomen committed Oct 15, 2023
1 parent b43127c commit 4f941be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"build": {
"type": "object",
"properties": {
"Configuration": {
"type": "string",
"enum": []
},
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
Expand Down
13 changes: 8 additions & 5 deletions Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class Build : NukeBuild

string PullRequestBase => GitHubActions?.BaseRef;

[Parameter]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.CI;

[Parameter("Use this parameter if you encounter build problems in any way, " +
"to generate a .binlog file which holds some useful information.")]
readonly bool? GenerateBinLog;
Expand Down Expand Up @@ -126,7 +129,7 @@ class Build : NukeBuild
DotNetBuild(s => s
.SetProjectFile(Solution)
.SetConfiguration(Configuration.CI)
.SetConfiguration(Configuration)
.When(GenerateBinLog is true, _ => _
.SetBinaryLog(ArtifactsDirectory / $"{Solution.Core.FluentAssertions.Name}.binlog")
)
Expand All @@ -145,7 +148,7 @@ class Build : NukeBuild
Project project = Solution.Specs.Approval_Tests;
DotNetTest(s => s
.SetConfiguration(Configuration.Release)
.SetConfiguration(Configuration)
.SetProcessEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
.EnableNoBuild()
.SetResultsDirectory(TestResultsDirectory)
Expand Down Expand Up @@ -192,7 +195,7 @@ class Build : NukeBuild
const string net47 = "net47";
DotNetTest(s => s
.SetConfiguration(Configuration.Debug)
.SetConfiguration(Configuration)
.SetProcessEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
.EnableNoBuild()
.SetDataCollector("XPlat Code Coverage")
Expand Down Expand Up @@ -284,7 +287,7 @@ from framework in supportedFrameworks
select new { project, framework };
DotNetTest(s => s
.SetConfiguration(Configuration.Debug)
.SetConfiguration(Configuration)
.SetProcessEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
.EnableNoBuild()
.SetDataCollector("XPlat Code Coverage")
Expand Down Expand Up @@ -318,7 +321,7 @@ from framework in supportedFrameworks
DotNetPack(s => s
.SetProject(Solution.Core.FluentAssertions)
.SetOutputDirectory(ArtifactsDirectory)
.SetConfiguration(Configuration.Release)
.SetConfiguration(Configuration)
.EnableNoLogo()
.EnableNoRestore()
.EnableContinuousIntegrationBuild() // Necessary for deterministic builds
Expand Down

0 comments on commit 4f941be

Please sign in to comment.