Skip to content

Commit

Permalink
Build: Add unit test logger (#55)
Browse files Browse the repository at this point in the history
* Test: Add GitHubActions logger for unit tests

* UITest: Add GitHubActions logger for UI tests

* UITest: use ManagePackageVersionsCentrally

* Build: try to fix step summary headers

* Build: fix syntax error

* Build: fix minor formatting issue

* UITest: add Directory.Build.props
  • Loading branch information
jbe2277 authored Nov 1, 2024
1 parent a1b9407 commit 83d9d5a
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 36 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/System.Waf.CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ jobs:
run: dotnet build ./src/System.Waf/System.Waf.sln -c Release -p:ContinuousIntegrationBuild=true

- name: 🕵️ Test
run: dotnet test ./src/System.Waf/System.Waf.sln -c Release --no-build
run: |
echo "## 🕵️ Test Results - System.Waf.sln" >> $Env:GITHUB_STEP_SUMMARY
dotnet test ./src/System.Waf/System.Waf.sln -c Release --no-build --logger GitHubActions
- name: 📦 Upload NuGet Packages
uses: actions/upload-artifact@v4
Expand All @@ -39,7 +41,9 @@ jobs:
src/System.Waf/System.Waf/**/*.snupkg
- name: 🖥️ UI Test
run: dotnet test ./src/Samples.UITest/Samples.UITest.sln --logger "console;verbosity=detailed" -maxCpuCount:1
run: |
echo "## 🕵️ Test Results - Samples.UITest.sln" >> $Env:GITHUB_STEP_SUMMARY
dotnet test ./src/Samples.UITest/Samples.UITest.sln --logger GitHubActions -maxCpuCount:1
- name: 📦 Upload UI Test results
uses: actions/upload-artifact@v4
Expand Down
10 changes: 4 additions & 6 deletions src/Samples.UITest/BookLibrary.Test/BookLibrary.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>UITest.BookLibrary</RootNamespace>

<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="GitHubActionsTestLogger" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="xunit" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/Samples.UITest/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
14 changes: 14 additions & 0 deletions src/Samples.UITest/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="FlaUI.UIA3" Version="4.0.0" />
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="xunit" Version="2.9.0" />
<PackageVersion Include="xunit.abstractions" Version="2.0.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>UITest.InformationManager</RootNamespace>

<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="GitHubActionsTestLogger" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="xunit" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 7 additions & 1 deletion src/Samples.UITest/Samples.UITest.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookLibrary.Test", "BookLib
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UITest.Core", "UITest.Core\UITest.Core.csproj", "{4B2174D9-B723-42AA-90DA-2F556409F19A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InformationManager.Test", "InformationManager.Test\InformationManager.Test.csproj", "{18006BE9-7056-48FB-97CF-F7B25C43358B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InformationManager.Test", "InformationManager.Test\InformationManager.Test.csproj", "{18006BE9-7056-48FB-97CF-F7B25C43358B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DAAFA839-8A98-4353-9AAD-CD1484DFEDE5}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
7 changes: 2 additions & 5 deletions src/Samples.UITest/UITest.Core/UITest.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>UITest</RootNamespace>

<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FlaUI.UIA3" Version="4.0.0" />
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="FlaUI.UIA3" />
<PackageReference Include="xunit.abstractions" />
</ItemGroup>
</Project>
10 changes: 4 additions & 6 deletions src/Samples.UITest/Writer.Test/Writer.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>UITest.Writer</RootNamespace>

<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="GitHubActionsTestLogger" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="xunit" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 2 additions & 4 deletions src/System.Waf/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MinVer">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MinVer" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
</ItemGroup>

<Choose>
Expand All @@ -24,6 +21,7 @@
<RunSettingsFilePath>$(MSBuildThisFileDirectory)CodeCoverage.runsettings</RunSettingsFilePath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="MSTest.TestAdapter" />
<PackageReference Include="MSTest.TestFramework" />
Expand Down
13 changes: 7 additions & 6 deletions src/System.Waf/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup>
<!-- Build -->
<!-- Build -->
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="MinVer" Version="6.0.0" />

<!-- WAF -->
<PackageVersion Include="System.ComponentModel.Annotations" Version="4.5.0" />
<PackageVersion Include="System.ComponentModel.Composition" Version="4.7.0" />

<!-- Samples-->
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.8" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SQLite" Version="8.0.8" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration.CommandLine" Version="8.0.0" />
<PackageVersion Include="NLog" Version="5.3.4" />

<!-- Unit tests -->
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.6.0" />
<PackageVersion Include="MSTest.TestFramework" Version="3.6.0" />
</ItemGroup>
</Project>
</Project>

0 comments on commit 83d9d5a

Please sign in to comment.