From 95d7b93823a9287c23855a2d67d6f9714fe8c46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E6=98=9F=E7=B9=81?= Date: Wed, 13 Nov 2024 15:53:26 +0800 Subject: [PATCH 1/5] chore: go net9 --- .github/workflows/ci.yml | 14 +++++++++++++- .github/workflows/pack.yml | 2 +- Directory.Build.props | 2 +- ...blogs.Architecture.Ddd.Cqrs.Abstractions.csproj | 9 +++++++++ ...Cnblogs.Architecture.Ddd.Cqrs.AspNetCore.csproj | 10 +++++++++- ...blogs.Architecture.Ddd.Cqrs.ServiceAgent.csproj | 8 ++++++++ ...d.Infrastructure.CacheProviders.InMemory.csproj | 13 +++++++++---- ...s.Architecture.Ddd.Infrastructure.Dapper.csproj | 7 +++++++ ...cture.Ddd.Infrastructure.EntityFramework.csproj | 2 +- ...logs.Architecture.IntegrationTestProject.csproj | 4 ---- .../Program.cs | 8 -------- .../Cnblogs.Architecture.IntegrationTests.csproj | 10 ++++++++-- .../Cnblogs.Architecture.TestShared.csproj | 4 ++-- .../Cnblogs.Architecture.UnitTests.csproj | 2 +- 14 files changed, 69 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa3c664..ad5ce92 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: branches: [ "main" ] jobs: - test: + test-net8: runs-on: ubuntu-latest container: mcr.microsoft.com/dotnet/sdk:8.0 @@ -18,4 +18,16 @@ jobs: run: ./build.sh - name: Test run: ./test.sh + + test-net9: + runs-on: ubuntu-latest + container: mcr.microsoft.com/dotnet/sdk:9.0 + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build + run: ./build.sh + - name: Test + run: ./test.sh diff --git a/.github/workflows/pack.yml b/.github/workflows/pack.yml index 0feb310..124a3e3 100644 --- a/.github/workflows/pack.yml +++ b/.github/workflows/pack.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-dotnet@v3 with: - dotnet-version: '8' + dotnet-version: '9' - name: Nuget Push env: nuget_key: ${{ secrets.NUGETAPIKEY }} diff --git a/Directory.Build.props b/Directory.Build.props index e620c99..5b2e9d9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - net8.0 + net8.0;net9.0 enable enable Cnblogs diff --git a/src/Cnblogs.Architecture.Ddd.Cqrs.Abstractions/Cnblogs.Architecture.Ddd.Cqrs.Abstractions.csproj b/src/Cnblogs.Architecture.Ddd.Cqrs.Abstractions/Cnblogs.Architecture.Ddd.Cqrs.Abstractions.csproj index a3d6d3e..1113372 100644 --- a/src/Cnblogs.Architecture.Ddd.Cqrs.Abstractions/Cnblogs.Architecture.Ddd.Cqrs.Abstractions.csproj +++ b/src/Cnblogs.Architecture.Ddd.Cqrs.Abstractions/Cnblogs.Architecture.Ddd.Cqrs.Abstractions.csproj @@ -17,8 +17,17 @@ + + + + + + + + + diff --git a/src/Cnblogs.Architecture.Ddd.Cqrs.AspNetCore/Cnblogs.Architecture.Ddd.Cqrs.AspNetCore.csproj b/src/Cnblogs.Architecture.Ddd.Cqrs.AspNetCore/Cnblogs.Architecture.Ddd.Cqrs.AspNetCore.csproj index 9069513..7dbbbcf 100644 --- a/src/Cnblogs.Architecture.Ddd.Cqrs.AspNetCore/Cnblogs.Architecture.Ddd.Cqrs.AspNetCore.csproj +++ b/src/Cnblogs.Architecture.Ddd.Cqrs.AspNetCore/Cnblogs.Architecture.Ddd.Cqrs.AspNetCore.csproj @@ -8,9 +8,17 @@ - + + + + + + + + + diff --git a/src/Cnblogs.Architecture.Ddd.Cqrs.ServiceAgent/Cnblogs.Architecture.Ddd.Cqrs.ServiceAgent.csproj b/src/Cnblogs.Architecture.Ddd.Cqrs.ServiceAgent/Cnblogs.Architecture.Ddd.Cqrs.ServiceAgent.csproj index 0abf125..090e93e 100644 --- a/src/Cnblogs.Architecture.Ddd.Cqrs.ServiceAgent/Cnblogs.Architecture.Ddd.Cqrs.ServiceAgent.csproj +++ b/src/Cnblogs.Architecture.Ddd.Cqrs.ServiceAgent/Cnblogs.Architecture.Ddd.Cqrs.ServiceAgent.csproj @@ -9,8 +9,16 @@ + + + + + + + + CqrsHeaderNames.cs diff --git a/src/Cnblogs.Architecture.Ddd.Infrastructure.CacheProviders.InMemory/Cnblogs.Architecture.Ddd.Infrastructure.CacheProviders.InMemory.csproj b/src/Cnblogs.Architecture.Ddd.Infrastructure.CacheProviders.InMemory/Cnblogs.Architecture.Ddd.Infrastructure.CacheProviders.InMemory.csproj index 95e0ed4..32e6024 100644 --- a/src/Cnblogs.Architecture.Ddd.Infrastructure.CacheProviders.InMemory/Cnblogs.Architecture.Ddd.Infrastructure.CacheProviders.InMemory.csproj +++ b/src/Cnblogs.Architecture.Ddd.Infrastructure.CacheProviders.InMemory/Cnblogs.Architecture.Ddd.Infrastructure.CacheProviders.InMemory.csproj @@ -7,12 +7,17 @@ - - + + - - + + + + + + + diff --git a/src/Cnblogs.Architecture.Ddd.Infrastructure.Dapper/Cnblogs.Architecture.Ddd.Infrastructure.Dapper.csproj b/src/Cnblogs.Architecture.Ddd.Infrastructure.Dapper/Cnblogs.Architecture.Ddd.Infrastructure.Dapper.csproj index 922a3e0..9be1738 100644 --- a/src/Cnblogs.Architecture.Ddd.Infrastructure.Dapper/Cnblogs.Architecture.Ddd.Infrastructure.Dapper.csproj +++ b/src/Cnblogs.Architecture.Ddd.Infrastructure.Dapper/Cnblogs.Architecture.Ddd.Infrastructure.Dapper.csproj @@ -10,7 +10,14 @@ + + + + + + + diff --git a/src/Cnblogs.Architecture.Ddd.Infrastructure.EntityFramework/Cnblogs.Architecture.Ddd.Infrastructure.EntityFramework.csproj b/src/Cnblogs.Architecture.Ddd.Infrastructure.EntityFramework/Cnblogs.Architecture.Ddd.Infrastructure.EntityFramework.csproj index c86356a..dca9848 100644 --- a/src/Cnblogs.Architecture.Ddd.Infrastructure.EntityFramework/Cnblogs.Architecture.Ddd.Infrastructure.EntityFramework.csproj +++ b/src/Cnblogs.Architecture.Ddd.Infrastructure.EntityFramework/Cnblogs.Architecture.Ddd.Infrastructure.EntityFramework.csproj @@ -9,7 +9,7 @@ - + diff --git a/test/Cnblogs.Architecture.IntegrationTestProject/Cnblogs.Architecture.IntegrationTestProject.csproj b/test/Cnblogs.Architecture.IntegrationTestProject/Cnblogs.Architecture.IntegrationTestProject.csproj index a8e0376..9c4c9b5 100644 --- a/test/Cnblogs.Architecture.IntegrationTestProject/Cnblogs.Architecture.IntegrationTestProject.csproj +++ b/test/Cnblogs.Architecture.IntegrationTestProject/Cnblogs.Architecture.IntegrationTestProject.csproj @@ -1,9 +1,5 @@  - - - - diff --git a/test/Cnblogs.Architecture.IntegrationTestProject/Program.cs b/test/Cnblogs.Architecture.IntegrationTestProject/Program.cs index 45aef48..fed4166 100644 --- a/test/Cnblogs.Architecture.IntegrationTestProject/Program.cs +++ b/test/Cnblogs.Architecture.IntegrationTestProject/Program.cs @@ -19,17 +19,9 @@ // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddCnblogsApiVersioning(); -builder.Services.AddSwaggerGen(); var app = builder.Build(); -// Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) -{ - app.UseSwagger(); - app.UseSwaggerUI(); -} - app.UseAuthorization(); app.MapControllers(); diff --git a/test/Cnblogs.Architecture.IntegrationTests/Cnblogs.Architecture.IntegrationTests.csproj b/test/Cnblogs.Architecture.IntegrationTests/Cnblogs.Architecture.IntegrationTests.csproj index ddc8f48..685c378 100644 --- a/test/Cnblogs.Architecture.IntegrationTests/Cnblogs.Architecture.IntegrationTests.csproj +++ b/test/Cnblogs.Architecture.IntegrationTests/Cnblogs.Architecture.IntegrationTests.csproj @@ -1,7 +1,6 @@ - @@ -14,6 +13,13 @@ + + + + + + + @@ -22,7 +28,7 @@ - + diff --git a/test/Cnblogs.Architecture.TestShared/Cnblogs.Architecture.TestShared.csproj b/test/Cnblogs.Architecture.TestShared/Cnblogs.Architecture.TestShared.csproj index 9f010e2..e633a27 100644 --- a/test/Cnblogs.Architecture.TestShared/Cnblogs.Architecture.TestShared.csproj +++ b/test/Cnblogs.Architecture.TestShared/Cnblogs.Architecture.TestShared.csproj @@ -1,6 +1,6 @@ - - + + \ No newline at end of file diff --git a/test/Cnblogs.Architecture.UnitTests/Cnblogs.Architecture.UnitTests.csproj b/test/Cnblogs.Architecture.UnitTests/Cnblogs.Architecture.UnitTests.csproj index 1e6dabb..3880bba 100644 --- a/test/Cnblogs.Architecture.UnitTests/Cnblogs.Architecture.UnitTests.csproj +++ b/test/Cnblogs.Architecture.UnitTests/Cnblogs.Architecture.UnitTests.csproj @@ -1,7 +1,7 @@ - + From 48210c3ae078f9da39e0ae1a423ae09b7baa07fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E6=98=9F=E7=B9=81?= Date: Wed, 13 Nov 2024 16:08:11 +0800 Subject: [PATCH 2/5] ci: specify framework version --- .github/workflows/ci.yml | 10 +++++----- build.sh | 4 ++-- test.sh | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad5ce92..6697e17 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,10 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Build - run: ./build.sh + run: ./build.sh net8.0 - name: Test - run: ./test.sh - + run: ./test.sh net8.0 + test-net9: runs-on: ubuntu-latest container: mcr.microsoft.com/dotnet/sdk:9.0 @@ -27,7 +27,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Build - run: ./build.sh + run: ./build.sh net9.0 - name: Test - run: ./test.sh + run: ./test.sh net9.0 diff --git a/build.sh b/build.sh index 3b38df0..5c736c2 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -e -dotnet restore -dotnet build -c Release +dotnet restore -p:TargetFramework="$1" +dotnet build -c Release -p:TargetFramework="$1" diff --git a/test.sh b/test.sh index 651757d..6738766 100755 --- a/test.sh +++ b/test.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash set -e -dotnet test -c Release +dotnet test -c Release -p:TargetFramework="$1" From 239ba47efcc0b2017b01cdb2e35a706e2da8f2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E6=98=9F=E7=B9=81?= Date: Wed, 13 Nov 2024 16:12:41 +0800 Subject: [PATCH 3/5] ci: skip restore when building --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 5c736c2..6908b50 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -e dotnet restore -p:TargetFramework="$1" -dotnet build -c Release -p:TargetFramework="$1" +dotnet build -c Release -p:TargetFramework="$1" --no-restore From 158781824977f04f7b21b19b7c3aa07a96aef8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E6=98=9F=E7=B9=81?= Date: Wed, 13 Nov 2024 16:18:24 +0800 Subject: [PATCH 4/5] ci: use -f instead of -p for testing --- test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 6738766..2c7d4f9 100755 --- a/test.sh +++ b/test.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash set -e -dotnet test -c Release -p:TargetFramework="$1" +dotnet test -c Release -f "$1" From 97fb1794c38c7a221aca990375abef7b6cc6f914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E6=98=9F=E7=B9=81?= Date: Wed, 13 Nov 2024 16:21:10 +0800 Subject: [PATCH 5/5] ci: do not build or restore when testing --- test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 2c7d4f9..4c41aad 100755 --- a/test.sh +++ b/test.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash set -e -dotnet test -c Release -f "$1" +dotnet test -c Release -f "$1" --no-build --no-restore