Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat warnings as errors during CI build (Lombiq Technologies: OCORE-157) #15764

Merged
merged 13 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/mac_unit_test_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ jobs:
- uses: actions/checkout@v4
- name: Build and test
run: |
dotnet build -c Release
dotnet build -c Release -warnaserror /p:TreatWarningsAsErrors=true /p:RunAnalyzersDuringBuild=true
MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved
dotnet test -c Release --no-restore --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj
2 changes: 1 addition & 1 deletion .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
dotnet-version: '8.0.x'
- name: Build
run: |
dotnet build -c Release
dotnet build -c Release -warnaserror /p:TreatWarningsAsErrors=true /p:RunAnalyzersDuringBuild=true
- name: Unit Tests
run: |
dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
dotnet-version: '8.0.x'
- name: Build
run: |
dotnet build -c Release
dotnet build -c Release -warnaserror /p:TreatWarningsAsErrors=true /p:RunAnalyzersDuringBuild=true
- name: Unit Tests
run: |
dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/preview_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:TreatWarningsAsErrors=true /p:RunAnalyzersDuringBuild=true
- name: Unit Tests
if: steps.check-publish.outputs.should-publish == 'true'
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:TreatWarningsAsErrors=true /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
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<!-- Avoid using cref tags with a prefix -->
<NoWarn>$(NoWarn);CA1200</NoWarn>

<!--Rename type name X so that it does not end in 'Delegate', 'EventHandler', 'Permission' etc -->
<!-- Rename type name X so that it does not end in 'Delegate', 'EventHandler', 'Permission' etc -->
<NoWarn>$(NoWarn);CA1711</NoWarn>

<!-- Parameter name differs from original overriden implemented name -->
Expand All @@ -54,7 +54,7 @@
<!-- Use PascalCase for named placeholders in the logging message template -->
<NoWarn>$(NoWarn);CA1727</NoWarn>

<!--CA1861 : Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array -->
<!-- CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array -->
<NoWarn>$(NoWarn);CA1861</NoWarn>

</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/OrchardCore.Build/OrchardCore.Commons.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<VersionPrefix>1.9.0</VersionPrefix>
<VersionSuffix>preview</VersionSuffix>
<VersionSuffix Condition="'$(VersionSuffix)'!='' AND '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>612,618</WarningsNotAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591</NoWarn>
Expand Down
1 change: 0 additions & 1 deletion src/OrchardCore.Cms.Web/OrchardCore.Cms.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<PropertyGroup>
<TargetFrameworks>$(CommonTargetFrameworks)</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>612,618</WarningsNotAsErrors>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<RazorRuntimeCompilation>false</RazorRuntimeCompilation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
This setting changes that so that the .template.config folder will be included.
-->
<NoDefaultExcludes>True</NoDefaultExcludes>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<PackageType>Template</PackageType>
<!--
The previous code used a nuget package to allow the 'RoslynCodeTaskFactory' (see the ReplaceFileText task definition below) to be used.
Expand All @@ -24,7 +23,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.
-->
<NoWarn>CS8021,CS2008,NU5128</NoWarn>
<NoWarn>CS8021;CS2008;NU5128;CA1016</NoWarn>
<!--
Prevent the symbol package from being created as this nuget package doesn't have package refs or assemblies.
Otherwise, the following error will be thrown by `dotnet pack`: error NU5017: Cannot create a package that has no dependencies nor content.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

<PropertyGroup>
<TargetFrameworks>$(CommonTargetFrameworks)</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RootNamespace>OrchardCore</RootNamespace>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<PropertyGroup>
<TargetFrameworks>$(CommonTargetFrameworks)</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<RazorRuntimeCompilation>false</RazorRuntimeCompilation>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion test/OrchardCore.Tests/OrchardCore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

<PropertyGroup>
<TargetFrameworks>$(CommonTargetFrameworks)</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
Expand Down