Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"isRoot": true,
"tools": {
"dotnet-validate": {
"version": "0.0.1-preview.304",
"version": "0.0.1-preview.537",
"commands": [
"dotnet-validate"
]
],
"rollForward": true
}
}
}
91 changes: 24 additions & 67 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,14 @@ env:
ContinuousIntegrationBuild: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true
TERM: xterm-256color

jobs:
package:
strategy:
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]
dotnet-version: ['481', '6.0', '8.0']
framework-version: ['netstandard2.0', 'net6.0']
exclude:
- os: macos-latest
dotnet-version: 481
- os: ubuntu-latest
dotnet-version: 481
- dotnet-version: 481
framework-version: net6.0
- dotnet-version: 6.0
framework-version: netstandard2.0
- dotnet-version: 8.0
framework-version: netstandard2.0
fail-fast: false
runs-on: ${{ matrix.os }}
name: Build and run tests
Expand All @@ -36,116 +25,84 @@ jobs:
fetch-depth: 0
- uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
if: matrix.dotnet-version != '481'
dotnet-version: |
6.x
8.x

- name: Restore NuGet packages for CoreTest
run: dotnet restore --no-dependencies -p:TargetFramework=net${{ matrix.dotnet-version }} --verbosity normal CoreTest
- name: Restore library Core
run: dotnet restore --verbosity normal Core
- name: Build library Core
run: dotnet build --configuration Release --no-restore --verbosity normal Core
- name: Build test project CoreTest
run: dotnet build --configuration Release --no-restore -p:TargetFramework=net${{ matrix.dotnet-version }} --verbosity normal CoreTest
- name: Run tests CoreTest
run: dotnet test --configuration Release --no-build -P:TargetFramework=net${{ matrix.dotnet-version }} --logger:"html;LogFileName=../../TestResults-CoreTest-${{ matrix.os }}-dotnet_${{ matrix.dotnet-version }}.html" --verbosity normal CoreTest
- name: Restore NuGet packages
run: dotnet restore

- name: Restore NuGet packages for PixelCanvasTest
run: dotnet restore --no-dependencies -p:TargetFramework=net${{ matrix.dotnet-version }} --verbosity normal PixelCanvasTest
- name: Restore library PixelCanvas
run: dotnet restore --verbosity normal PixelCanvas
- name: Build library PixelCanvas
run: dotnet build --configuration Release --no-restore --verbosity normal PixelCanvas
- name: Build test project PixelCanvasTest
run: dotnet build --configuration Release --no-restore -p:TargetFramework=net${{ matrix.dotnet-version }} --verbosity normal PixelCanvasTest
- name: Run tests PixelCanvasTest
run: dotnet test --configuration Release --no-build -P:TargetFramework=net${{ matrix.dotnet-version }} --logger:"html;LogFileName=../../TestResults-PixelCanvasTest-${{ matrix.os }}-dotnet_${{ matrix.dotnet-version }}.html" --verbosity normal PixelCanvasTest
- name: Build solution
run: dotnet build --no-restore --verbosity normal

- name: Restore NuGet packages for WindowsTest
run: dotnet restore --no-dependencies -p:TargetFramework=net${{ matrix.dotnet-version }} --verbosity normal WindowsTest
if: startsWith(matrix.os,'windows')
- name: Restore library Windows
run: dotnet restore --verbosity normal Windows
if: startsWith(matrix.os,'windows')
- name: Build library Windows
run: dotnet build --configuration Release --no-restore --verbosity normal Windows
if: startsWith(matrix.os,'windows')
- name: Build test project WindowsTest
run: dotnet build --configuration Release --no-restore -p:TargetFramework=net${{ matrix.dotnet-version }} --verbosity normal WindowsTest
if: startsWith(matrix.os,'windows')
- name: Run tests WindowsTest
run: dotnet test --configuration Release --no-build -P:TargetFramework=net${{ matrix.dotnet-version }} --logger:"html;LogFileName=../../TestResults-WindowsTest-${{ matrix.os }}-dotnet_${{ matrix.dotnet-version }}.html" --verbosity normal WindowsTest
if: startsWith(matrix.os,'windows')
- name: Run tests
run: dotnet test --no-build --verbosity normal

- name: Upload received files from failing tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: Received-${{ runner.os }}-${{ matrix.dotnet-version }}
name: Received-${{ runner.os }}
path: "**/*.received.*"
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: TestResults-${{ runner.os }}-${{ matrix.dotnet-version }}
name: TestResults-${{ runner.os }}
path: TestResults-*.html

- name: Create and validate NuGet package for Core
run: dotnet pack --no-build --verbosity normal Core/Core.csproj
if: startsWith(matrix.os,'windows')
- name: Create and validate NuGet package for PixelCanvas
run: dotnet pack --no-build --verbosity normal PixelCanvas/PixelCanvas.csproj
if: startsWith(matrix.os,'windows')
- name: Create and validate NuGet package for Windows
run: dotnet pack --no-build --verbosity normal WindowsTest/WindowsTest.csproj
- name: Create and validate NuGet packages
run: |
dotnet tool restore
dotnet pack --no-build --verbosity normal
if: startsWith(matrix.os,'windows')

- name: Set up JDK 17 (for SonarQube)
if: startsWith(matrix.os,'windows') && matrix.dotnet-version == '8.0'
if: startsWith(matrix.os,'windows')
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
- name: Cache SonarCloud packages
if: startsWith(matrix.os,'windows') && matrix.dotnet-version == '8.0'
if: startsWith(matrix.os,'windows')
uses: actions/cache@v4
with:
path: ~\.sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
if: startsWith(matrix.os,'windows') && matrix.dotnet-version == '8.0'
if: startsWith(matrix.os,'windows')
id: cache-sonar-scanner
uses: actions/cache@v4
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: startsWith(matrix.os,'windows') && matrix.dotnet-version == '8.0' && steps.cache-sonar-scanner.outputs.cache-hit != 'true'
if: startsWith(matrix.os,'windows') && steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Cache dotnet-coverage
if: startsWith(matrix.os,'windows') && matrix.dotnet-version == '8.0'
if: startsWith(matrix.os,'windows')
id: cache-dotnet-coverage
uses: actions/cache@v4
with:
path: .\.dotnet-coverage
key: ${{ runner.os }}-dotnet-coverage
restore-keys: ${{ runner.os }}-dotnet-coverage
- name: Install dotnet-coverage
if: startsWith(matrix.os,'windows') && matrix.dotnet-version == '8.0' && steps.cache-dotnet-coverage.outputs.cache-hit != 'true'
if: startsWith(matrix.os,'windows') && steps.cache-dotnet-coverage.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.dotnet-coverage -ItemType Directory
dotnet tool update dotnet-coverage --tool-path .\.dotnet-coverage
- name: Build and analyze
if: startsWith(matrix.os,'windows') && matrix.dotnet-version == '8.0'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
if: startsWith(matrix.os,'windows') && env.SONAR_TOKEN != ''
shell: powershell
run: |
dotnet clean
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ bld/
*.VisualState.xml
TestResult.xml

# xUnit.net
TestResults-*

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
Expand Down
6 changes: 1 addition & 5 deletions Core/Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="Microsoft.DotNet.PackageValidation" Version="1.0.0-preview.7.21379.12" />

<PropertyGroup>
<AssemblyName>Codecrete.SwissQRBill.Core</AssemblyName>
<RootNamespace>Codecrete.SwissQRBill.Generator</RootNamespace>
Expand Down Expand Up @@ -42,7 +40,7 @@ See home page https://github.com/manuelbl/SwissQRBill.NET for examples and other
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<EnablePackageValidation>true</EnablePackageValidation>
<PackageVersion>3.3.0</PackageVersion>
<PackageValidationBaselineVersion>3.0.0</PackageValidationBaselineVersion>
<PackageValidationBaselineVersion>3.3.0</PackageValidationBaselineVersion>
<Deterministic>True</Deterministic>
</PropertyGroup>

Expand All @@ -58,7 +56,6 @@ See home page https://github.com/manuelbl/SwissQRBill.NET for examples and other

<ItemGroup>
<PackageReference Include="Net.Codecrete.QrCodeGenerator" Version="2.*" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.*" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand All @@ -67,7 +64,6 @@ See home page https://github.com/manuelbl/SwissQRBill.NET for examples and other
</ItemGroup>

<Target Name="ValidateNuGetPackage" AfterTargets="Pack">
<Exec Command="dotnet tool restore" />
<Exec Command="dotnet validate package local $([MSBuild]::EnsureTrailingSlash($(PackageOutputPath)))$(PackageId).$(PackageVersion).nupkg" />
</Target>

Expand Down
58 changes: 17 additions & 41 deletions CoreTest/CoreTest.csproj
Original file line number Diff line number Diff line change
@@ -1,54 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>

<IsPackable>false</IsPackable>

<AssemblyName>Codecrete.SwissQRBill.CoreTest</AssemblyName>

<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">net481;$(TargetFrameworks)</TargetFrameworks>
<RootNamespace>Codecrete.SwissQRBill.CoreTest</RootNamespace>

<Authors>Manuel Bleichenbacher</Authors>

<Company>Codecrete</Company>

<Product>Swiss QR Bill</Product>

<Copyright>Open source published under MIT license</Copyright>

<PackageLicenseUrl></PackageLicenseUrl>

<Version>3.3.0</Version>

<PackageLicenseExpression>MIT</PackageLicenseExpression>

<LangVersion>7.3</LangVersion>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<TestResultsFile>$([System.IO.Path]::Combine($(MSBuildThisFileDirectory),'..','TestResults-$(MSBuildProjectName)-$(TargetFramework).html'))</TestResultsFile>
</PropertyGroup>

<ItemGroup>
<None Update="**\*.verified.*">
<ParentExtension>$(ProjectExt.Replace('proj', ''))</ParentExtension>
<ParentFile>$([System.String]::Copy('%(FileName)').Split('.')[0])</ParentFile>
<DependentUpon>%(ParentFile)%(ParentExtension)</DependentUpon>
</None>
<None Update="**\*.received.*">
<ParentExtension>$(ProjectExt.Replace('proj', ''))</ParentExtension>
<ParentFile>$([System.String]::Copy('%(FileName)').Split('.')[0])</ParentFile>
<DependentUpon>%(ParentFile)%(ParentExtension)</DependentUpon>
</None>
<VSTestLogger Include="html%3BLogFileName=$([System.IO.Path]::GetFullPath($(TestResultsFile)))" Visible="false" />
</ItemGroup>

<PropertyGroup>
<VSTestLogger>@(VSTestLogger)</VSTestLogger>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DiffEngine" Version="15.*" />
<PackageReference Include="Docnet.Core" Version="2.*" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.*" />
<PackageReference Include="SkiaSharp" Version="3.116.1" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.116.1" />
<PackageReference Include="Verify.ImageMagick" Version="3.*" />
<PackageReference Include="Verify.Xunit" Version="28.7.0" />
<PackageReference Include="xunit" Version="2.*" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0" PrivateAssets="all" />
<PackageReference Include="Docnet.Core" Version="2.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="SkiaSharp" Version="3.119.0" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.119.0" />
<PackageReference Include="Verify.ImageMagick" Version="3.7.0" />
<PackageReference Include="Verify.Xunit" Version="29.5.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 2 additions & 7 deletions CoreTest/VerifyImages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ public class VerifyImages

static VerifyImages()
{
VerifierSettings.RegisterFileConverter("pdf", ConvertPdfToPng);
VerifierSettings.RegisterStreamConverter("pdf", ConvertPdfToPng);
VerifyImageMagick.RegisterComparers(threshold: 0.1, ImageMagick.ErrorMetric.PerceptualHash);

Settings.UseDirectory("ReferenceFiles");
}

protected VerifyImages() { }

private static ConversionResult ConvertPdfToPng(Stream stream, IReadOnlyDictionary<string, object> context)
private static ConversionResult ConvertPdfToPng(string name, Stream stream, IReadOnlyDictionary<string, object> context)
{
var pngStreams = new List<Stream>();

Expand Down Expand Up @@ -76,11 +76,6 @@ public static SettingsTask VerifySvg(byte[] svg, [CallerFilePath] string sourceF
return Verifier.Verify(svg, settings: Settings, extension: "svg", sourceFile: sourceFile);
}

public static SettingsTask VerifyPng(byte[] png, [CallerFilePath] string sourceFile = "")
{
return Verifier.Verify(png, settings: Settings, extension: "png", sourceFile: sourceFile);
}

public static SettingsTask VerifyPdf(byte[] pdf, [CallerFilePath] string sourceFile = "")
{
return Verifier.Verify(pdf, settings: Settings, extension: "pdf", sourceFile: sourceFile);
Expand Down
6 changes: 1 addition & 5 deletions PixelCanvas/PixelCanvas.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="Microsoft.DotNet.PackageValidation" Version="1.0.0-preview.7.21379.12" />

<PropertyGroup>
<AssemblyName>Codecrete.SwissQRBill.Generator</AssemblyName>
<RootNamespace>Codecrete.SwissQRBill.PixelCanvas</RootNamespace>
Expand Down Expand Up @@ -43,7 +41,7 @@ See home page https://github.com/manuelbl/SwissQRBill.NET for examples and other
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<EnablePackageValidation>true</EnablePackageValidation>
<PackageVersion>3.3.0</PackageVersion>
<PackageValidationBaselineVersion>3.0.0</PackageValidationBaselineVersion>
<PackageValidationBaselineVersion>3.3.0</PackageValidationBaselineVersion>
<Deterministic>True</Deterministic>
</PropertyGroup>

Expand All @@ -59,7 +57,6 @@ See home page https://github.com/manuelbl/SwissQRBill.NET for examples and other

<ItemGroup>
<PackageReference Include="SkiaSharp" Version="3.*" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.*" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand All @@ -72,7 +69,6 @@ See home page https://github.com/manuelbl/SwissQRBill.NET for examples and other
</ItemGroup>

<Target Name="ValidateNuGetPackage" AfterTargets="Pack">
<Exec Command="dotnet tool restore" />
<Exec Command="dotnet validate package local $([MSBuild]::EnsureTrailingSlash($(PackageOutputPath)))$(PackageId).$(PackageVersion).nupkg" />
</Target>

Expand Down
Loading