diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd37440e..000b8aa9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ env: IS_CI_BUILD: 'true' SOLUTION_PATH: 'src/SaaStack.sln' TESTINGONLY_BUILD_CONFIGURATION: 'Release' - RELEASE_BUILD_CONFIGURATION: 'ReleaseForDeploy' + DEPLOY_BUILD_CONFIGURATION: 'ReleaseForDeploy' jobs: build-test: @@ -20,11 +20,11 @@ jobs: dotnet-version: 7.0.x - name: Restore dependencies run: dotnet restore "${{env.SOLUTION_PATH}}" - - name: Build for Release - run: dotnet build "${{env.SOLUTION_PATH}}" --no-restore --configuration ${{env.RELEASE_BUILD_CONFIGURATION}} + - name: Build for Deploy + run: dotnet build --configuration ${{env.DEPLOY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" - name: Build for Testing - run: dotnet build "${{env.SOLUTION_PATH}}" --no-restore --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} + run: dotnet build --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" - name: Unit Test - run: dotnet test --filter Category=Unit "${{env.SOLUTION_PATH}}" --no-build --verbosity normal + run: dotnet test --no-build --verbosity normal --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} --filter:Category="Unit" --collect:"XPlat Code Coverage" --results-directory:"src/TestResults/csharp" --logger:"trx" --logger:"junit;LogFileName={assembly}.junit.xml;MethodFormat=Class;FailureBodyFormat=Verbose" --test-adapter-path:. "${{env.SOLUTION_PATH}}" - name: Integration Test - run: dotnet test --filter Category=Integration "${{env.SOLUTION_PATH}}" --no-build --verbosity normal \ No newline at end of file + run: dotnet test --no-build --verbosity normal --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} --filter:Category="Integration" --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory:"src/TestResults/csharp" --logger:"trx" --logger:"junit;LogFileName={assembly}.junit.xml;MethodFormat=Class;FailureBodyFormat=Verbose" --test-adapter-path:. "${{env.SOLUTION_PATH}}" \ No newline at end of file diff --git a/src/Infrastructure.Api.Common.IntegrationTests/WebApiSpec.cs b/src/Infrastructure.Api.Common.IntegrationTests/WebApiSpec.cs index 368a7aa3..265fd12d 100644 --- a/src/Infrastructure.Api.Common.IntegrationTests/WebApiSpec.cs +++ b/src/Infrastructure.Api.Common.IntegrationTests/WebApiSpec.cs @@ -1,3 +1,4 @@ +#if TESTINGONLY using System.Net; using System.Net.Http.Json; using FluentAssertions; @@ -6,8 +7,6 @@ using Microsoft.AspNetCore.Mvc.Testing; using Xunit; -#if TESTINGONLY - namespace Infrastructure.Api.Common.IntegrationTests; [Trait("Category", "Integration.Web")] diff --git a/src/Infrastructure.WebApi.Common.UnitTests/SubDomainModulesSpec.cs b/src/Infrastructure.WebApi.Common.UnitTests/SubDomainModulesSpec.cs index 400cac91..339cda03 100644 --- a/src/Infrastructure.WebApi.Common.UnitTests/SubDomainModulesSpec.cs +++ b/src/Infrastructure.WebApi.Common.UnitTests/SubDomainModulesSpec.cs @@ -108,7 +108,14 @@ public void WhenConfigureHost_ThenAppliedToAllModules() public class TestModule : ISubDomainModule { - public Assembly? ApiAssembly { get; init; } - public Action? MinimalApiRegistrationFunction { get; init; } + public TestModule() + { + ApiAssembly = null!; + MinimalApiRegistrationFunction = null!; + RegisterServicesFunction = null!; + } + + public Assembly ApiAssembly { get; init; } + public Action MinimalApiRegistrationFunction { get; init; } public Action? RegisterServicesFunction { get; init; } } \ No newline at end of file