diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e6567ef..5a0354d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,7 @@ jobs: dotnet: ${{ steps.classify.outputs.dotnet }} aep: ${{ steps.classify.outputs.aep }} container: ${{ steps.classify.outputs.container }} + postgresql: ${{ steps.classify.outputs.postgresql }} steps: - name: Check out repository uses: actions/checkout@v7 @@ -62,15 +63,20 @@ jobs: $container = $runEverything -or @($changedFiles | Where-Object { $_ -match '^(src/|aep/src/|deploy/|Dockerfile$|\.dockerignore$|global\.json$|Agentstration\.slnx$|Directory\.(Build|Packages)\.(props|targets)$|\.github/workflows/ci\.yml$)' }).Count -gt 0 + $postgresql = $runEverything -or @($changedFiles | Where-Object { + $_ -match '^(src/Agentstration\.(Flow|Management|Runtime|Work)\.Storage\.(Abstractions|PostgreSql)/|src/Agentstration\.Infrastructure/|src/Agentstration\.Security\.AspNetCoreIdentity(\.PostgreSql)?/|src/Agentstration\.Web/(Program\.cs|appsettings.*\.json)$|tests/Agentstration\.Web\.Tests/(PostgreSqlStorageProfileTests|StorageConcurrencyBenchmarkTests|StorageOptionsTests|QuartzHostLifecycleTests)\.cs$|docker-compose\.postgresql\.yml$|\.env\.postgresql\.example$|global\.json$|Agentstration\.slnx$|Directory\.(Build|Packages)\.(props|targets)$|\.github/workflows/ci\.yml$)' + }).Count -gt 0 "dotnet=$($dotnet.ToString().ToLowerInvariant())" >> $env:GITHUB_OUTPUT "aep=$($aep.ToString().ToLowerInvariant())" >> $env:GITHUB_OUTPUT "container=$($container.ToString().ToLowerInvariant())" >> $env:GITHUB_OUTPUT + "postgresql=$($postgresql.ToString().ToLowerInvariant())" >> $env:GITHUB_OUTPUT Write-Host "Changed files: $($changedFiles.Count)" Write-Host "Run .NET validation: $dotnet" Write-Host "Run complete AEP validation: $aep" Write-Host "Build container: $container" + Write-Host "Run PostgreSQL validation: $postgresql" windows-host-lifecycle: name: windows-host-lifecycle @@ -152,6 +158,8 @@ jobs: postgresql-storage: name: postgresql-storage runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.postgresql == 'true' timeout-minutes: 20 services: postgres: @@ -169,6 +177,8 @@ jobs: --health-retries 12 env: AGENTSTRATION_TEST_POSTGRES: Host=127.0.0.1;Port=5432;Database=agentstration;Username=agentstration;Password=agentstration-ci-only + Agentstration__Storage__Provider: PostgreSql + ConnectionStrings__Agentstration: Host=127.0.0.1;Port=5432;Database=agentstration;Username=agentstration;Password=agentstration-ci-only steps: - name: Check out repository uses: actions/checkout@v7 @@ -181,7 +191,9 @@ jobs: - name: Build PostgreSQL integration tests run: dotnet build tests/Agentstration.Web.Tests/Agentstration.Web.Tests.csproj --configuration Release --no-restore - name: Run PostgreSQL migration and restart test - run: dotnet tests/Agentstration.Web.Tests/bin/Release/net10.0/Agentstration.Web.Tests.dll --filter "Name=EmptyDatabaseMigratesAndRemainsReadyAfterRestart" --progress off + run: dotnet tests/Agentstration.Web.Tests/bin/Release/net10.0/Agentstration.Web.Tests.dll --filter "TestCategory=PostgreSql" --progress off + - name: Run Web tests with PostgreSQL storage + run: dotnet tests/Agentstration.Web.Tests/bin/Release/net10.0/Agentstration.Web.Tests.dll --filter "TestCategory!=PostgreSql&TestCategory!=Sqlite&TestCategory!=Benchmark" --progress off - name: Run PostgreSQL storage concurrency benchmark env: AGENTSTRATION_STORAGE_BENCHMARK_PROVIDER: PostgreSql diff --git a/tests/Agentstration.Web.Tests/PostgreSqlStorageProfileTests.cs b/tests/Agentstration.Web.Tests/PostgreSqlStorageProfileTests.cs index fa7e718c..eccfad46 100644 --- a/tests/Agentstration.Web.Tests/PostgreSqlStorageProfileTests.cs +++ b/tests/Agentstration.Web.Tests/PostgreSqlStorageProfileTests.cs @@ -13,6 +13,7 @@ namespace Agentstration.Web.Tests; public sealed class PostgreSqlStorageProfileTests { [TestMethod] + [TestCategory("PostgreSql")] public async Task EmptyDatabaseMigratesAndRemainsReadyAfterRestart() { var connectionString = Environment.GetEnvironmentVariable("AGENTSTRATION_TEST_POSTGRES"); diff --git a/tests/Agentstration.Web.Tests/QuartzHostLifecycleTests.cs b/tests/Agentstration.Web.Tests/QuartzHostLifecycleTests.cs index 0a9bfa89..ef0b1fcc 100644 --- a/tests/Agentstration.Web.Tests/QuartzHostLifecycleTests.cs +++ b/tests/Agentstration.Web.Tests/QuartzHostLifecycleTests.cs @@ -47,6 +47,7 @@ public async Task DefaultTestingDataDirectoryIsRemovedAfterHostShutdown() } [TestMethod] + [TestCategory("Sqlite")] public async Task SchedulerDatabaseIsReleasedAfterEveryHostShutdown() { for (var iteration = 0; iteration < 3; iteration++)