diff --git a/.github/workflows/on-push-do-ci-build-pg15-jsonnet-eventsourcing.yml b/.github/workflows/on-push-do-ci-build-pg15-jsonnet-eventsourcing.yml index d03b9d58bd..6b43f68298 100644 --- a/.github/workflows/on-push-do-ci-build-pg15-jsonnet-eventsourcing.yml +++ b/.github/workflows/on-push-do-ci-build-pg15-jsonnet-eventsourcing.yml @@ -76,7 +76,7 @@ jobs: shell: bash - name: compile - run: ./build.sh compile + run: ./build.sh compile-project --project src/EventSourcingTests/EventSourcingTests.csproj shell: bash - name: test-event-sourcing diff --git a/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson-eventsourcing.yml b/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson-eventsourcing.yml index acc0e73f79..f72cbd881f 100644 --- a/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson-eventsourcing.yml +++ b/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson-eventsourcing.yml @@ -76,7 +76,7 @@ jobs: # shell: bash - name: compile - run: ./build.sh compile + run: ./build.sh compile-project --project src/EventSourcingTests/EventSourcingTests.csproj shell: bash - name: test-event-sourcing diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 18e8268376..fe5ac7fd44 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -28,6 +28,7 @@ "Benchmarks", "ClearInlineSamples", "Compile", + "CompileProject", "Connection", "CreateFreightShippingTutorialZip", "Detach", @@ -150,6 +151,9 @@ "Profile": { "type": "string" }, + "Project": { + "type": "string" + }, "Solution": { "type": "string", "description": "Path to a solution file that is automatically loaded" diff --git a/build/build.cs b/build/build.cs index 488363fb46..2e6392000f 100644 --- a/build/build.cs +++ b/build/build.cs @@ -26,6 +26,7 @@ class Build : NukeBuild [Parameter]readonly string Framework; [Parameter] readonly string Profile; [Parameter] readonly string ConnectionString ="Host=localhost;Port=5432;Database=marten_testing;Username=postgres;password=postgres"; + [Parameter] readonly string Project; Target Test => _ => _ .DependsOn(TestBaseLib) @@ -76,6 +77,28 @@ class Build : NukeBuild .SetProjectFile(Solution)); }); + Target CompileProject => _ => _ + .DependsOn(Init) + .Executes(() => + { + if (string.IsNullOrEmpty(Project)) + { + Log.Error("Project parameter is required. Usage: --project "); + throw new ArgumentException("Project parameter must be specified"); + } + + Log.Information($"Restoring project: {Project}"); + DotNetRestore(s => s + .SetProjectFile(Project)); + + Log.Information($"Compiling project: {Project}"); + DotNetBuild(s => s + .SetProjectFile(Project) + .SetConfiguration(Configuration) + .SetFramework(Framework) + .EnableNoRestore()); + }); + Target TestBaseLib => _ => _ .ProceedAfterFailure()