From b01e4144258fc271e04ebc604b7979ea507a73a1 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Sat, 13 Jan 2024 10:14:08 +0100 Subject: [PATCH 1/4] Remove unused PGPASSWORD environment variable --- .github/workflows/build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06609b8ccf..1a1b74f44f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,10 +23,6 @@ concurrency: env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: true - # The Windows runner image has PostgreSQL pre-installed and sets the PGPASSWORD environment variable to "root". - # This conflicts with the default password "postgres", which is used by ikalnytskyi/action-setup-postgres. - # Because action-setup-postgres forgets to update the environment variable accordingly, we do so here. - PGPASSWORD: "postgres" jobs: build-and-test: From a89d3f14424277bd2cd382079fcc8f5e8eb01c51 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Sat, 13 Jan 2024 10:21:03 +0100 Subject: [PATCH 2/4] Bump action-setup-postgres version --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a1b74f44f..26028cba5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: - name: Tune GitHub-hosted runner network uses: smorimoto/tune-github-hosted-runner-network@v1 - name: Setup PostgreSQL - uses: ikalnytskyi/action-setup-postgres@v4 + uses: ikalnytskyi/action-setup-postgres@v5 with: username: postgres password: postgres From fc5a0b7842253488d62834bd3da1f8094ebd35e6 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Sat, 13 Jan 2024 13:40:17 +0100 Subject: [PATCH 3/4] Reduce logging output when running tests in ci-build (#1430) --- .github/workflows/build.yml | 7 +++++++ test/DapperTests/IntegrationTests/DapperTestContext.cs | 4 ++++ test/TestBuildingBlocks/IntegrationTestContext.cs | 8 ++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 26028cba5a..eb3aab63b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -127,6 +127,13 @@ jobs: run: | dotnet build --no-restore --configuration Release /p:VersionSuffix=$env:PACKAGE_VERSION_SUFFIX - name: Test + env: + # Override log levels, to reduce logging output when running tests in ci-build. + Logging__LogLevel__Microsoft.Hosting.Lifetime: 'None' + Logging__LogLevel__Microsoft.AspNetCore.Hosting.Diagnostics: 'None' + Logging__LogLevel__Microsoft.Extensions.Hosting.Internal.Host: 'None' + Logging__LogLevel__Microsoft.EntityFrameworkCore.Database.Command: 'None' + Logging__LogLevel__JsonApiDotNetCore: 'None' run: | dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --logger "GitHubActions;summary.includeSkippedTests=true" - name: Upload coverage to codecov.io diff --git a/test/DapperTests/IntegrationTests/DapperTestContext.cs b/test/DapperTests/IntegrationTests/DapperTestContext.cs index 6bbcca6777..233162e2e8 100644 --- a/test/DapperTests/IntegrationTests/DapperTestContext.cs +++ b/test/DapperTests/IntegrationTests/DapperTestContext.cs @@ -69,6 +69,10 @@ private WebApplicationFactory CreateFactory() { if (_testOutputHelper != null) { +#if !DEBUG + // Reduce logging output when running tests in ci-build. + loggingBuilder.ClearProviders(); +#endif loggingBuilder.Services.AddSingleton(_ => new XUnitLoggerProvider(_testOutputHelper, "DapperExample.")); } }); diff --git a/test/TestBuildingBlocks/IntegrationTestContext.cs b/test/TestBuildingBlocks/IntegrationTestContext.cs index dc186b474b..83f00667b2 100644 --- a/test/TestBuildingBlocks/IntegrationTestContext.cs +++ b/test/TestBuildingBlocks/IntegrationTestContext.cs @@ -83,8 +83,8 @@ private WebApplicationFactory CreateFactory() }); }); - // We have placed an appsettings.json in the TestBuildingBlock project folder and set the content root to there. Note that controllers - // are not discovered in the content root but are registered manually using IntegrationTestContext.UseController. + // We have placed an appsettings.json in the TestBuildingBlocks project directory and set the content root to there. Note that + // controllers are not discovered in the content root, but are registered manually using IntegrationTestContext.UseController. WebApplicationFactory factoryWithConfiguredContentRoot = factory.WithWebHostBuilder(builder => builder.UseSolutionRelativeContentRoot($"test/{nameof(TestBuildingBlocks)}")); @@ -161,8 +161,8 @@ protected override IHostBuilder CreateHostBuilder() .CreateDefaultBuilder(null) .ConfigureAppConfiguration(builder => { - // For tests asserting on log output, we discard the logging settings from appsettings.json. - // But using appsettings.json for all other tests makes it easy to quickly toggle when debugging. + // For tests asserting on log output, we discard the log levels from appsettings.json and environment variables. + // But using appsettings.json for all other tests makes it easy to quickly toggle when debugging tests. if (_loggingConfiguration != null) { builder.Sources.Clear(); From 78c98b171259385f99d2bc9ffe9099c3836b341d Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Sat, 13 Jan 2024 14:17:18 +0100 Subject: [PATCH 4/4] Increment version to 5.5.2 (used for pre-release builds from ci) --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 0c2b51e13b..534f9bb7af 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -27,6 +27,6 @@ false $(MSBuildThisFileDirectory)CodingGuidelines.ruleset $(MSBuildThisFileDirectory)tests.runsettings - 5.5.1 + 5.5.2