From 9d0756801ee31bf4ea1a9723e60858990cc79ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Wed, 10 Apr 2024 16:07:59 +0200 Subject: [PATCH 01/10] Treat warnings as errors during CI build --- .github/workflows/mac_unit_test_ci.yml | 2 +- .github/workflows/main_ci.yml | 2 +- .github/workflows/pr_ci.yml | 2 +- .github/workflows/preview_ci.yml | 2 +- .github/workflows/release_ci.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/mac_unit_test_ci.yml b/.github/workflows/mac_unit_test_ci.yml index cb5a8e63b21..7ba1d3f0574 100644 --- a/.github/workflows/mac_unit_test_ci.yml +++ b/.github/workflows/mac_unit_test_ci.yml @@ -13,5 +13,5 @@ jobs: - uses: actions/checkout@v3 - name: Build and test run: | - dotnet build -c Release + dotnet build -c Release --warnaserror -p:RunAnalyzersDuringBuild=True dotnet test -c Release --no-restore --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml index ca8bc847223..fa478440e54 100644 --- a/.github/workflows/main_ci.yml +++ b/.github/workflows/main_ci.yml @@ -27,7 +27,7 @@ jobs: dotnet-version: '8.0.x' - name: Build run: | - dotnet build -c Release + dotnet build -c Release --warnaserror -p:RunAnalyzersDuringBuild=True - name: Unit Tests run: | dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj diff --git a/.github/workflows/pr_ci.yml b/.github/workflows/pr_ci.yml index 7dcde8681af..418731c42c3 100644 --- a/.github/workflows/pr_ci.yml +++ b/.github/workflows/pr_ci.yml @@ -26,7 +26,7 @@ jobs: dotnet-version: '8.0.x' - name: Build run: | - dotnet build -c Release + dotnet build -c Release --warnaserror -p:RunAnalyzersDuringBuild=True - name: Unit Tests run: | dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index fe25acb75b8..c4219d197fa 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -35,7 +35,7 @@ jobs: - name: Build if: steps.check-publish.outputs.should-publish == 'true' run: | - dotnet build -c Release + dotnet build -c Release --warnaserror -p:RunAnalyzersDuringBuild=True - name: Unit Tests if: steps.check-publish.outputs.should-publish == 'true' run: | diff --git a/.github/workflows/release_ci.yml b/.github/workflows/release_ci.yml index 3d3d1c312e3..19616b5a4a7 100644 --- a/.github/workflows/release_ci.yml +++ b/.github/workflows/release_ci.yml @@ -41,7 +41,7 @@ jobs: run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 15471 ))" >> $GITHUB_ENV - name: Build run: | - dotnet build -c Release -p:Version=${{ steps.get_version.outputs.VERSION }} + dotnet build -c Release --warnaserror -p:RunAnalyzersDuringBuild=True -p:Version=${{ steps.get_version.outputs.VERSION }} - name: Unit Tests run: | dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj From fdaeb7f3d1f6653dda7ac60e4a9d8657b7480ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Wed, 10 Apr 2024 16:26:32 +0200 Subject: [PATCH 02/10] Suppressing CA1016 --- Directory.Build.props | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 235d562dc61..30002df456a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -33,7 +33,7 @@ $(NoWarn);CA1200 - + $(NoWarn);CA1711 @@ -54,9 +54,12 @@ $(NoWarn);CA1727 - + $(NoWarn);CA1861 + + $(NoWarn);CA1016 + From f2f5d56bd6baf0de5105f80ac16647f31786a6b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Mon, 15 Apr 2024 20:49:11 +0200 Subject: [PATCH 03/10] Disabling CA1016 only in OrchardCore.ProjectTemplates --- Directory.Build.props | 3 --- .../OrchardCore.ProjectTemplates.csproj | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 30002df456a..735e9c009c9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -57,9 +57,6 @@ $(NoWarn);CA1861 - - $(NoWarn);CA1016 - diff --git a/src/Templates/OrchardCore.ProjectTemplates/OrchardCore.ProjectTemplates.csproj b/src/Templates/OrchardCore.ProjectTemplates/OrchardCore.ProjectTemplates.csproj index ba64f3403aa..8c7af6de538 100644 --- a/src/Templates/OrchardCore.ProjectTemplates/OrchardCore.ProjectTemplates.csproj +++ b/src/Templates/OrchardCore.ProjectTemplates/OrchardCore.ProjectTemplates.csproj @@ -24,7 +24,7 @@ The error message is not accurate, as it indicates there is no content. It should say assemblies instead, since we have content but no assemblies. NU5128 warning: Ignore since the project template package doesn't contain content or references to other packages. --> - CS8021,CS2008,NU5128 + CS8021;CS2008;NU5128;CA1016 True - False Template