Skip to content

Commit

Permalink
Merge branch 'release/8.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmairegger committed Feb 19, 2024
2 parents 871e858 + 5e172ae commit 757b472
Show file tree
Hide file tree
Showing 32 changed files with 583 additions and 226 deletions.
36 changes: 35 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,38 @@ csharp_preserve_single_line_statements = true

# IDE0073: File header
dotnet_diagnostic.IDE0073.severity = warning
file_header_template = Copyright 2017-2022 Michael Mairegger\n\nLicensed under the Apache License, Version 2.0 (the "License")\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.
file_header_template = Copyright 2017-2022 Michael Mairegger\n\nLicensed under the Apache License, Version 2.0 (the "License")\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.


# Mairegger Custom
[*.{cs,vb}]

#CA1303: Do not pass literals as localized parameters
dotnet_diagnostic.CA1303.severity = error

#CA1304: Specify CultureInfo
dotnet_diagnostic.CA1304.severity = error

#CA1305: Specify IFormatProvider
dotnet_diagnostic.CA1305.severity = error

#CA1307: Specify StringComparison for clarity
dotnet_diagnostic.CA1307.severity = error

#CA1308: Normalize strings to uppercase
dotnet_diagnostic.CA1308.severity = error

#CA1309: Use ordinal StringComparison
dotnet_diagnostic.CA1309.severity = error

#CA1310: Specify StringComparison for correctness
dotnet_diagnostic.CA1310.severity = error

#CA1311: Specify a culture or use an invariant version
dotnet_diagnostic.CA1311.severity = error

#CA1708: Identifiers should differ by more than case
dotnet_diagnostic.CA1708.severity = error

#CA1707: Identifiers should not contain underscores
dotnet_diagnostic.CA1707.severity = error
23 changes: 16 additions & 7 deletions .github/actions/build-and-test/action.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
name: 'Compile, test'
description: 'Compiles and tests the project'
inputs:
buildConfiguration:
description: Defines the build configuration like Debug or Release
required: true
workingDirectory:
description: Defines the base working directory containing the solution file
required: true

outputs:
nuget-package-version:
description: Returns the nuget package version
value: ${{ steps.nbgv.outputs.NuGetPackageVersion }}

runs:
using: "composite"
steps:
- uses: actions/setup-dotnet@v2
- uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- uses: dotnet/nbgv@master
id: nbgv

- name: Cache SonarCloud packages
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
Expand All @@ -31,6 +36,7 @@ runs:
- name: Install SonarCloud scanner
shell: pwsh
run: dotnet tool update dotnet-sonarscanner -g
if: github.ref == 'refs/heads/master'

- name: Install reportgenerator
shell: pwsh
Expand All @@ -43,8 +49,9 @@ runs:

- name: Sonarscanner begin
shell: pwsh
run: dotnet sonarscanner begin /k:"mairegger.printing" /o:"mairegger" /v:"${{ steps.nbgv.outputs.NuGetPackageVersion }}" /d:sonar.login="${{ env.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths="sonarqubecoverage\SonarQube.xml"
run: dotnet sonarscanner begin /k:"mairegger.printing" /o:"mairegger" /v:"${{ steps.nbgv.outputs.NuGetPackageVersion }}" /d:sonar.login="${{ env.SONAR_TOKEN }}" /d:sonar.host.url="${{ env.SONAR_HOST }}" /d:sonar.coverageReportPaths="sonarqubecoverage\SonarQube.xml"
working-directory: ${{ inputs.workingDirectory }}
if: github.ref == 'refs/heads/master'

- name: Build
shell: pwsh
Expand All @@ -56,14 +63,16 @@ runs:
run: dotnet test --configuration ${{ inputs.buildConfiguration }} --no-build --collect:"XPlat Code Coverage"
working-directory: ${{ inputs.workingDirectory }}

- name: Set up JDK 11
uses: actions/setup-java@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 1.11
java-version: '17'
if: github.ref == 'refs/heads/master'

- name: Sonarscanner end
shell: pwsh
run: |
reportgenerator "-reports:*\TestResults\*\coverage.cobertura.xml" "-targetdir:sonarqubecoverage" "-reporttypes:SonarQube"
dotnet sonarscanner end /d:sonar.login="${{ env.SONAR_TOKEN }}"
working-directory: ${{ inputs.workingDirectory }}
working-directory: ${{ inputs.workingDirectory }}
if: github.ref == 'refs/heads/master'
24 changes: 20 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
name: Build
on:
push:
branches:
- main
- dev
- migrate/net8

env:
buildConfiguration: 'Release'
workingDirectory: 'src'

jobs:
build:
build-production:
if: github.ref == 'refs/heads/main'
runs-on: windows-latest
environment: production
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: ./.github/actions/build-and-test
with:
buildConfiguration: ${{ env.buildConfiguration }}
workingDirectory: ${{ env.workingDirectory }}

build-ci:
if: github.ref != 'refs/heads/main'
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -18,6 +37,3 @@ jobs:
with:
buildConfiguration: ${{ env.buildConfiguration }}
workingDirectory: ${{ env.workingDirectory }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
43 changes: 22 additions & 21 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
name: Publish
on:
push:
tags:
tags:
- 'v*.*.*'

env:
buildConfiguration: 'Release'
workingDirectory: 'src'

jobs:
build:
deploy:
runs-on: windows-latest
environment: production
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: ./.github/actions/build-and-test
id: build-and-test
with:
buildConfiguration: ${{ env.buildConfiguration }}
workingDirectory: ${{ env.workingDirectory }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST: ${{ secrets.SONAR_HOST }}

- uses: ./.github/actions/build-and-test
id: build-and-test
with:
buildConfiguration: ${{ env.buildConfiguration }}
workingDirectory: ${{ env.workingDirectory }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Pack
run: dotnet pack --configuration Release --no-build /p:Version=${{ steps.build-and-test.outputs.nuget-package-version }} --output artifacts
working-directory: src

- name: Pack
run: dotnet pack --configuration Release --no-build /p:Version=${{ steps.build-and-test.outputs.nuget-package-version }} --output artifacts
working-directory: src

- name: Push with dotnet
run: dotnet nuget push artifacts\*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
working-directory: src
- name: Push with dotnet
run: dotnet nuget push artifacts\*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
working-directory: src
4 changes: 4 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
<PackageProjectUrl>$(GithubUrl)</PackageProjectUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<RepositoryUrl>$(GithubUrl)</RepositoryUrl>

<NeutralLanguage>en</NeutralLanguage>
</PropertyGroup>

<PropertyGroup>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>

<AnalysisLevel>latest-recommended</AnalysisLevel>
</PropertyGroup>

<PropertyGroup Label="CompilerInformation">
Expand Down
12 changes: 6 additions & 6 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project>

<ItemGroup Label="Rider">
<None Remove="$(MSBuildProjectDirectory)\*.DotSettings" />
</ItemGroup>

<PropertyGroup>
<ParentDirectoryBuildPropsPath>$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))</ParentDirectoryBuildPropsPath>
</PropertyGroup>
<Import Project="$(ParentDirectoryBuildPropsPath)" Condition="'$(ParentDirectoryBuildPropsPath)' != '' and Exists($(ParentDirectoryBuildPropsPath))" />

</Project>

<ItemGroup Label="Rider">
<None Remove="$(MSBuildProjectDirectory)\*.DotSettings" />
</ItemGroup>

</Project>
55 changes: 34 additions & 21 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,44 +1,57 @@
<Project>
<Import Project="Versions.props" />

<PropertyGroup Label="Target Frameworks">
<NetCoreAppMinimum>net6.0</NetCoreAppMinimum>
<NetCoreAppCurrent>net7.0</NetCoreAppCurrent>
<!-- .NET Framework Support Dates https://docs.microsoft.com/en-us/lifecycle/products/microsoft-net-framework -->
<!-- .NET Support Dates https://docs.microsoft.com/de-de/lifecycle/products/microsoft-net-and-net-core -->
<TargetFrameworks>net462;$(NetCoreAppMinimum)-windows;$(NetCoreAppCurrent)-windows</TargetFrameworks>
<NetCoreAppCurrent Condition="'$(CurrentNetVersion)' != ''">net$(CurrentNetVersion.Substring(0,3))</NetCoreAppCurrent>
<NetCoreAppPrevious Condition="'$(PreviousNetVersion)' != ''">net$(PreviousNetVersion.Substring(0,3))</NetCoreAppPrevious>
<NetCoreAppMinimum Condition="'$(MinimumNetVersion)' != ''">net$(MinimumNetVersion.Substring(0,3))</NetCoreAppMinimum>

<NetCoreWpfCurrent Condition="'$(CurrentNetVersion)' != ''">$(NetCoreAppCurrent)-windows$(WindowsSdkVersion)</NetCoreWpfCurrent>
<NetCoreWpfPrevious Condition="'$(PreviousNetVersion)' != ''">$(NetCoreAppPrevious)-windows$(WindowsSdkVersion)</NetCoreWpfPrevious>
<NetCoreWpfMinimum Condition="'$(MinimumNetVersion)' != ''">$(NetCoreAppMinimum)-windows$(WindowsSdkVersion)</NetCoreWpfMinimum>

<AspNetCoreVersion Condition="$(TargetFramework.StartsWith($(NetCoreAppCurrent)))">$(CurrentNetVersion)</AspNetCoreVersion>
<AspNetCoreVersion Condition="$(TargetFramework.StartsWith($(NetCoreAppPrevious)))">$(PreviousNetVersion)</AspNetCoreVersion>
<AspNetCoreVersion Condition="$(TargetFramework.StartsWith($(NetCoreAppMinimum)))">$(MinimumNetVersion)</AspNetCoreVersion>
</PropertyGroup>

<PropertyGroup Label="Set WPF properties">
<TargetFrameworks>$(NetCoreWpfCurrent);$(NetCoreWpfPrevious);$(NetCoreWpfMinimum);$(NetFrameworkMinimum)</TargetFrameworks>
<UseWPF>true</UseWPF>
</PropertyGroup>

<PropertyGroup Label="NuGet settings">
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<EnablePackageVersionOverride>false</EnablePackageVersionOverride>
<WarningsAsErrors>$(WarningsAsErrors);NU1506</WarningsAsErrors>
<!-- Duplicate 'PackageVersion' items found -->
<WarningsAsErrors>$(WarningsAsErrors);NU1504</WarningsAsErrors>
<!-- Duplicate 'PackageReference' items found -->
<WarningsAsErrors>$(WarningsAsErrors);NU1506</WarningsAsErrors>
<!-- Duplicate 'PackageVersion' items found -->
<!--<WarningsAsErrors>$(WarningsAsErrors);NU1507</WarningsAsErrors> -->
<!-- Multiple package source defined in config file -->

<!-- A package restored for your project has a known vulnerability. -->
<WarningsAsErrors>$(WarningsAsErrors);<!--low-->NU1901;<!--moderate-->NU1902;<!--high-->NU1903;<!--citical-->NU1904</WarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<NerdbankGitVersioningVersion>3.5.107</NerdbankGitVersioningVersion>
<!--Testing -->
<MoqVersion>4.18.4</MoqVersion>
<NUnitVersion>3.13.3</NUnitVersion>
<NUnit3TestAdapter>4.4.2</NUnit3TestAdapter>
<MicrosoftNETTestSdkVersion>17.5.0</MicrosoftNETTestSdkVersion>
<CoverletCollectorVersion>3.2.0</CoverletCollectorVersion>
<WpfAnalyzersVersion>4.1.1</WpfAnalyzersVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" PrivateAssets="all" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" PrivateAssets="all" Condition="'$(Configuration)' == 'Release'" Version="$(NerdbankGitVersioningVersion)" />
<GlobalPackageReference Include="WpfAnalyzers" Condition="'$(UseWpf)' == 'true'" Version="$(WpfAnalyzersVersion)" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" Condition="'$(IsPackable)' == 'true'"/>
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" Condition="'$(IsPackable)' == 'true'"/>
</ItemGroup>

<ItemGroup>
<PackageVersion Include="JetBrains.Annotations" Version="2022.3.1" />
<PackageVersion Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" />
<PackageVersion Include="Moq" Version="$(MoqVersion)" />
<PackageVersion Include="NUnit" Version="$(NUnitVersion)" />
<PackageVersion Include="NUnit.Analyzers" Version="$(NUnitAnalyzers)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="NUnit3TestAdapter" Version="$(NUnit3TestAdapter)" />
<PackageVersion Include="System.Drawing.Common" Version="7.0.0" />
<PackageVersion Include="System.Drawing.Common" Version="8.0.2" />
<PackageVersion Include="coverlet.collector" Version="$(CoverletCollectorVersion)" />
</ItemGroup>
</Project>
</Project>
Loading

0 comments on commit 757b472

Please sign in to comment.