Skip to content

Commit ccb3848

Browse files
committed
Add trimmable tests
1 parent 6b7311b commit ccb3848

File tree

5 files changed

+49
-3
lines changed

5 files changed

+49
-3
lines changed

.github/workflows/wf-build-test.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ jobs:
8686
- name: Run test .NET 6.0 Windows
8787
working-directory: QRCoderTests
8888
run: dotnet test -c Release -f net6.0-windows --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
89-
89+
90+
- name: Run trim analysis
91+
working-directory: QRCoderTrimAnalysis
92+
run: dotnet publish -c Release -o bin/publish
93+
9094
- name: Run API approval tests
9195
working-directory: QRCoderApiTests
9296
run: dotnet test -c Release --nologo --no-build

QRCoder.sln

+20-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRCoderTests", "QRCoderTest
1515
EndProject
1616
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRCoder.Xaml", "QRCoder.Xaml\QRCoder.Xaml.csproj", "{A7A7E073-2504-4BA2-A63B-87AC34174789}"
1717
EndProject
18-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRCoderApiTests", "QRCoderApiTests\QRCoderApiTests.csproj", "{5FACE5F6-53C9-4B89-91D4-162677893574}"
18+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRCoderApiTests", "QRCoderApiTests\QRCoderApiTests.csproj", "{5FACE5F6-53C9-4B89-91D4-162677893574}"
1919
EndProject
20-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRCoderBenchmarks", "QRCoderBenchmarks\QRCoderBenchmarks.csproj", "{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}"
20+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRCoderBenchmarks", "QRCoderBenchmarks\QRCoderBenchmarks.csproj", "{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}"
21+
EndProject
22+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRCoderTrimAnalysis", "QRCoderTrimAnalysis\QRCoderTrimAnalysis.csproj", "{F046136A-7BEA-49F3-9415-70CE50AD533B}"
2123
EndProject
2224
Global
2325
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -155,6 +157,22 @@ Global
155157
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Release|x64.Build.0 = Release|Any CPU
156158
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Release|x86.ActiveCfg = Release|Any CPU
157159
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Release|x86.Build.0 = Release|Any CPU
160+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
161+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|Any CPU.Build.0 = Debug|Any CPU
162+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|ARM.ActiveCfg = Debug|Any CPU
163+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|ARM.Build.0 = Debug|Any CPU
164+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|x64.ActiveCfg = Debug|Any CPU
165+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|x64.Build.0 = Debug|Any CPU
166+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|x86.ActiveCfg = Debug|Any CPU
167+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Debug|x86.Build.0 = Debug|Any CPU
168+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|Any CPU.ActiveCfg = Release|Any CPU
169+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|Any CPU.Build.0 = Release|Any CPU
170+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|ARM.ActiveCfg = Release|Any CPU
171+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|ARM.Build.0 = Release|Any CPU
172+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|x64.ActiveCfg = Release|Any CPU
173+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|x64.Build.0 = Release|Any CPU
174+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|x86.ActiveCfg = Release|Any CPU
175+
{F046136A-7BEA-49F3-9415-70CE50AD533B}.Release|x86.Build.0 = Release|Any CPU
158176
EndGlobalSection
159177
GlobalSection(SolutionProperties) = preSolution
160178
HideSolutionNode = FALSE

QRCoder/QRCoder.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<DefineConstants Condition="'$(TargetFramework)' == 'net6.0-windows'">$(DefineConstants);NET6_0_WINDOWS</DefineConstants>
99
<CheckEolTargetFramework>false</CheckEolTargetFramework>
1010
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
11+
<IsTrimmable Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">true</IsTrimmable>
1112
</PropertyGroup>
1213

1314
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

QRCoderTrimAnalysis/Program.cs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// See https://aka.ms/new-console-template for more information
2+
Console.WriteLine("Hello, World!");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<!-- This project, when published, verifies that QRCoder is trimmable; see below link for more details. -->
4+
<!-- https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/prepare-libraries-for-trimming?pivots=dotnet-6-0 -->
5+
6+
<PropertyGroup>
7+
<OutputType>Exe</OutputType>
8+
<TargetFramework>net8.0</TargetFramework>
9+
<ImplicitUsings>enable</ImplicitUsings>
10+
<Nullable>enable</Nullable>
11+
<PublishTrimmed>true</PublishTrimmed>
12+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors><!-- Ensure that trim warnings cause the publish to fail -->
13+
<IsPackable>false</IsPackable>
14+
</PropertyGroup>
15+
16+
<ItemGroup>
17+
<ProjectReference Include="..\QRCoder\QRCoder.csproj" />
18+
<TrimmerRootAssembly Include="QRCoder" />
19+
</ItemGroup>
20+
21+
</Project>

0 commit comments

Comments
 (0)