Skip to content

Commit

Permalink
Add trimmable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane32 committed May 25, 2024
1 parent 6b7311b commit ccb3848
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/wf-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ jobs:
- name: Run test .NET 6.0 Windows
working-directory: QRCoderTests
run: dotnet test -c Release -f net6.0-windows --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover


- name: Run trim analysis
working-directory: QRCoderTrimAnalysis
run: dotnet publish -c Release -o bin/publish

- name: Run API approval tests
working-directory: QRCoderApiTests
run: dotnet test -c Release --nologo --no-build
Expand Down
22 changes: 20 additions & 2 deletions QRCoder.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRCoderTests", "QRCoderTest
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRCoder.Xaml", "QRCoder.Xaml\QRCoder.Xaml.csproj", "{A7A7E073-2504-4BA2-A63B-87AC34174789}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRCoderApiTests", "QRCoderApiTests\QRCoderApiTests.csproj", "{5FACE5F6-53C9-4B89-91D4-162677893574}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRCoderApiTests", "QRCoderApiTests\QRCoderApiTests.csproj", "{5FACE5F6-53C9-4B89-91D4-162677893574}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRCoderBenchmarks", "QRCoderBenchmarks\QRCoderBenchmarks.csproj", "{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRCoderBenchmarks", "QRCoderBenchmarks\QRCoderBenchmarks.csproj", "{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRCoderTrimAnalysis", "QRCoderTrimAnalysis\QRCoderTrimAnalysis.csproj", "{F046136A-7BEA-49F3-9415-70CE50AD533B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -155,6 +157,22 @@ Global
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Release|x64.Build.0 = Release|Any CPU
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Release|x86.ActiveCfg = Release|Any CPU
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Release|x86.Build.0 = Release|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|ARM.ActiveCfg = Debug|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|ARM.Build.0 = Debug|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|x64.ActiveCfg = Debug|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|x64.Build.0 = Debug|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|x86.ActiveCfg = Debug|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|x86.Build.0 = Debug|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|Any CPU.Build.0 = Release|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|ARM.ActiveCfg = Release|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|ARM.Build.0 = Release|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|x64.ActiveCfg = Release|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|x64.Build.0 = Release|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|x86.ActiveCfg = Release|Any CPU
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions QRCoder/QRCoder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<DefineConstants Condition="'$(TargetFramework)' == 'net6.0-windows'">$(DefineConstants);NET6_0_WINDOWS</DefineConstants>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<IsTrimmable Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">true</IsTrimmable>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand Down
2 changes: 2 additions & 0 deletions QRCoderTrimAnalysis/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
21 changes: 21 additions & 0 deletions QRCoderTrimAnalysis/QRCoderTrimAnalysis.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<!-- This project, when published, verifies that QRCoder is trimmable; see below link for more details. -->
<!-- https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/prepare-libraries-for-trimming?pivots=dotnet-6-0 -->

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishTrimmed>true</PublishTrimmed>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors><!-- Ensure that trim warnings cause the publish to fail -->
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\QRCoder\QRCoder.csproj" />
<TrimmerRootAssembly Include="QRCoder" />
</ItemGroup>

</Project>

0 comments on commit ccb3848

Please sign in to comment.