Skip to content

Commit

Permalink
Merge pull request #1069 from dorssel/mstest
Browse files Browse the repository at this point in the history
Use MSTest SDK
  • Loading branch information
dorssel authored Nov 24, 2024
2 parents af1ed0c + 4a8e3ca commit 2c154e9
Show file tree
Hide file tree
Showing 16 changed files with 179 additions and 83 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/build-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@ jobs:
cache-dependency-path: '**/packages.lock.json'

- name: Install dependencies
run: dotnet restore
run: |
dotnet restore
dotnet restore Installer
- name: Build
run: dotnet build --configuration Release --no-restore
run: |
dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --logger trx
run: |
dotnet test --configuration Release --no-build `
-p:TestingPlatformCommandLineArguments="--report-trx --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml"
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
Expand All @@ -58,7 +63,10 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Build (Installer)
run: dotnet build --configuration Release Installer
run: |
dotnet publish --configuration Release --no-build Usbipd
dotnet publish --configuration Release --no-build Usbipd.PowerShell
dotnet build --configuration Release --no-restore Installer
- name: Upload Installer Artifact
uses: actions/upload-artifact@v4
Expand Down
20 changes: 6 additions & 14 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,12 @@ SPDX-License-Identifier: GPL-3.0-only
<!-- Use the latest .NET SDK -->
<!-- This product requires Windows 10 (Windows Server 2019) or higher -->
<MainTargetFramework>net9.0-windows10.0.17763</MainTargetFramework>
</PropertyGroup>

<!-- Sane defaults; override in project where needed -->

<PropertyGroup Condition="$(TargetFramework) == 'netstandard2.0'">
<!-- For PowerShell, we support everything -->
<Platforms>AnyCPU</Platforms>
<Platform>AnyCPU</Platform>
</PropertyGroup>

<PropertyGroup Condition="$(TargetFramework) != 'netstandard2.0'">
<!-- This product only supports x64 (the only architecture supported by VBoxUsb) -->
<Platforms>x64</Platforms>
<Platform>x64</Platform>
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>

<!-- Sane defaults; override in project where needed -->

<PropertyGroup>
<!-- This allows building on Linux; however, building the installer requires Windows -->
<EnableWindowsTargeting>true</EnableWindowsTargeting>
Expand All @@ -48,12 +37,15 @@ SPDX-License-Identifier: GPL-3.0-only
<SelfContained>false</SelfContained>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<DebugType Condition=" '$(Configuration)' == 'Release' ">None</DebugType>
<CopyOutputSymbolsToPublishDirectory>false</CopyOutputSymbolsToPublishDirectory>
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
<GenerateDependencyFile>false</GenerateDependencyFile>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
<!--
See https://github.com/dotnet/roslyn/issues/41640
-->
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PublishDocumentationFiles>false</PublishDocumentationFiles>
<NoWarn>CS1591</NoWarn>

<!-- Deterministic builds -->
Expand Down
5 changes: 0 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ SPDX-License-Identifier: GPL-3.0-only
<PackageVersion Include="WixToolset.UI.wixext" Version="5.0.2" />
<PackageVersion Include="WixToolset.Util.wixext" Version="5.0.2" />
<!-- UnitTests -->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageVersion Include="MSTest.TestFramework" Version="3.6.3" />
<PackageVersion Include="System.IO.Pipelines" Version="9.0.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
</ItemGroup>
</Project>
10 changes: 4 additions & 6 deletions Installer/Installer.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ SPDX-License-Identifier: GPL-3.0-only
-->
<Project Sdk="WixToolset.Sdk">
<PropertyGroup>
<Platform>x64</Platform>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<GenerateGitVersionInformation>false</GenerateGitVersionInformation>
<UpdateAssemblyInfo>false</UpdateAssemblyInfo>
<OutputName>usbipd-win</OutputName>
<PublishDir>..\Usbipd\bin\publish</PublishDir>
<PowerShellDir>..\Usbipd.PowerShell\bin\$(Configuration)\netstandard2.0</PowerShellDir>
<PowerShellDir>..\Usbipd.PowerShell\bin\publish</PowerShellDir>
<DefineConstants>PublishDir=$(PublishDir);PowerShellDir=$(PowerShellDir);DriversDir=..\Drivers;Copyright=$(Copyright)</DefineConstants>
<Pedantic>true</Pedantic>
</PropertyGroup>
Expand Down Expand Up @@ -55,10 +56,7 @@ SPDX-License-Identifier: GPL-3.0-only
<Output TaskParameter="Value" PropertyName="DefineConstants" />
</CreateProperty>
</Target>
<Target Name="PublishUsbipd" BeforeTargets="BeforeBuild">
<Message Importance="high" Text="Publishing pre-built usbipd-win" />
<RemoveDir Directories="$(PublishDir)" />
<MakeDir Directories="$(PublishDir)" />
<Exec Command="dotnet publish --nologo --no-restore --no-build --framework $(MainTargetFramework) ..\Usbipd" />
<Target Name="AssumePublishedDependencies" BeforeTargets="BeforeBuild">
<Message Importance="high" Text="Making installer for (assumed) pre-published Usbipd and Usbipd.PowerShell" />
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
//
// SPDX-License-Identifier: GPL-3.0-only

[assembly: CLSCompliant(false)]
[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)]
[assembly: DiscoverInternals]
[assembly: Parallelize(Workers = 0, Scope = ExecutionScope.MethodLevel)]
15 changes: 8 additions & 7 deletions UnitTests/UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@ SPDX-FileCopyrightText: 2022 Frans van Dorsselaer
SPDX-License-Identifier: GPL-3.0-only
-->
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="MSTest.Sdk">

<PropertyGroup>
<TargetFrameworks>$(MainTargetFramework)</TargetFrameworks>
<TargetFramework>$(MainTargetFramework)</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<IsAotCompatible>false</IsAotCompatible>
</PropertyGroup>

<PropertyGroup>
<!-- Updates to transitive MSTest.Sdk dependencies -->
<MicrosoftNETTestSdkVersion>17.12.0</MicrosoftNETTestSdkVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.Windows.CsWin32" PrivateAssets="all" />
<PackageReference Include="Moq" />
<PackageReference Include="MSTest.TestAdapter" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="System.IO.Pipelines" />
<PackageReference Include="coverlet.collector" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
136 changes: 122 additions & 14 deletions UnitTests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
"version": 2,
"dependencies": {
"net9.0-windows10.0.17763": {
"coverlet.collector": {
"type": "Direct",
"requested": "[6.0.2, )",
"resolved": "6.0.2",
"contentHash": "bJShQ6uWRTQ100ZeyiMqcFlhP7WJ+bCuabUs885dJiBEzMsJMSFr7BOyeCw4rgvQokteGi5rKQTlkhfQPUXg2A=="
},
"GitVersion.MsBuild": {
"type": "Direct",
"requested": "[6.0.5, )",
Expand All @@ -24,6 +18,28 @@
"Microsoft.TestPlatform.TestHost": "17.12.0"
}
},
"Microsoft.Testing.Extensions.CodeCoverage": {
"type": "Direct",
"requested": "[17.12.6, )",
"resolved": "17.12.6",
"contentHash": "SYMv2ScahQUj2X7fM9yfZcg/jMmX4odGhuNV7DHNIJUQrQIueM1Xjco+nhv7YbuSaRYWuXV6W08r/dbdH0pq9g==",
"dependencies": {
"Microsoft.DiaSymReader": "2.0.0",
"Microsoft.Extensions.DependencyModel": "6.0.1",
"Microsoft.Testing.Platform": "1.4.0",
"System.Reflection.Metadata": "8.0.0"
}
},
"Microsoft.Testing.Extensions.TrxReport": {
"type": "Direct",
"requested": "[1.4.3, )",
"resolved": "1.4.3",
"contentHash": "JSy1dY8ZpNWV00NZBVAQuqJmC18LOszwRsIz4VSROK06FxoPOz5N19D6FHz9ZKJxn3XieoHWhbvuLFWdz9UJiw==",
"dependencies": {
"Microsoft.Testing.Extensions.TrxReport.Abstractions": "1.4.3",
"Microsoft.Testing.Platform": "1.4.3"
}
},
"Microsoft.Windows.CsWin32": {
"type": "Direct",
"requested": "[0.3.106, )",
Expand All @@ -44,6 +60,12 @@
"Castle.Core": "5.1.1"
}
},
"MSTest.Analyzers": {
"type": "Direct",
"requested": "[3.6.3, )",
"resolved": "3.6.3",
"contentHash": "TfM4wkpgJ9YKqQp3BjDGLCAckRwEuRvcE6Nw4Ge3r8dw6GOCpFKavyigTyD+IjV3SoMd0LvUDdjh5MGW0Oe8Wg=="
},
"MSTest.TestAdapter": {
"type": "Direct",
"requested": "[3.6.3, )",
Expand All @@ -60,12 +82,6 @@
"resolved": "3.6.3",
"contentHash": "jockRcUoLJMeHzLqFcMnZBrWy7tS32JP7shlepDDJuf5A6HO2PwAefXzhvprcWNkfpEwmR0KihSO2HRXwNbTng=="
},
"System.IO.Pipelines": {
"type": "Direct",
"requested": "[9.0.0, )",
"resolved": "9.0.0",
"contentHash": "eA3cinogwaNB4jdjQHOP3Z3EuyiDII7MT35jgtnsA4vkn0LUrrSHsU0nzHTzFzmaFYeKV7MYyMxOocFzsBHpTw=="
},
"Castle.Core": {
"type": "Transitive",
"resolved": "5.1.1",
Expand All @@ -87,6 +103,11 @@
"resolved": "17.12.0",
"contentHash": "4svMznBd5JM21JIG2xZKGNanAHNXplxf/kQDFfLHXQ3OnpJkayRK/TjacFjA+EYmoyuNXHo/sOETEfcYtAzIrA=="
},
"Microsoft.DiaSymReader": {
"type": "Transitive",
"resolved": "2.0.0",
"contentHash": "QcZrCETsBJqy/vQpFtJc+jSXQ0K5sucQ6NUFbTNVHD4vfZZOwjZ/3sBzczkC4DityhD3AVO/+K/+9ioLs1AgRA=="
},
"Microsoft.Extensions.Configuration": {
"type": "Transitive",
"resolved": "9.0.0",
Expand Down Expand Up @@ -177,6 +198,18 @@
"resolved": "9.0.0",
"contentHash": "+6f2qv2a3dLwd5w6JanPIPs47CxRbnk+ZocMJUhv9NxP88VlOcJYZs9jY+MYSjxvady08bUZn6qgiNh7DadGgg=="
},
"Microsoft.Extensions.DependencyModel": {
"type": "Transitive",
"resolved": "6.0.1",
"contentHash": "AdvrtrqZpMgW4tIAQ/8gE1LAM/FjFY8JrFdyiolOf9WLEfN3WuFG1Hje6n0jqaOs3ldZFGWhatJQHJRrIOd++w==",
"dependencies": {
"System.Buffers": "4.5.1",
"System.Memory": "4.5.4",
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
"System.Text.Encodings.Web": "6.0.0",
"System.Text.Json": "6.0.10"
}
},
"Microsoft.Extensions.Diagnostics": {
"type": "Transitive",
"resolved": "9.0.0",
Expand Down Expand Up @@ -447,6 +480,16 @@
"resolved": "13.0.1",
"contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A=="
},
"System.Buffers": {
"type": "Transitive",
"resolved": "4.5.1",
"contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
"System.Collections.Immutable": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "AurL6Y5BA1WotzlEvVaIDpqzpIPvYnnldxru8oXJU2yFxFUy3+pNXjXd1ymO+RA0rq0+590Q8gaz2l3Sr7fmqg=="
},
"System.Diagnostics.DiagnosticSource": {
"type": "Transitive",
"resolved": "5.0.0",
Expand All @@ -457,10 +500,23 @@
"resolved": "9.0.0",
"contentHash": "qd01+AqPhbAG14KtdtIqFk+cxHQFZ/oqRSCoxU1F+Q6Kv0cl726sl7RzU9yLFGd4BUOKdN4XojXF0pQf/R6YeA=="
},
"System.Memory": {
"type": "Transitive",
"resolved": "4.5.4",
"contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw=="
},
"System.Reflection.Metadata": {
"type": "Transitive",
"resolved": "1.6.0",
"contentHash": "COC1aiAJjCoA5GBF+QKL2uLqEBew4JsCkQmoHKbN3TlOZKa2fKLz5CpiRQKDz0RsAOEGsVKqOD5bomsXq/4STQ=="
"resolved": "8.0.0",
"contentHash": "ptvgrFh7PvWI8bcVqG5rsA/weWM09EnthFHR5SCnS6IN+P4mj6rE1lBDC4U8HL9/57htKAqy4KQ3bBj84cfYyQ==",
"dependencies": {
"System.Collections.Immutable": "8.0.0"
}
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
},
"System.ServiceProcess.ServiceController": {
"type": "Transitive",
Expand All @@ -470,6 +526,23 @@
"System.Diagnostics.EventLog": "9.0.0"
}
},
"System.Text.Encodings.Web": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Text.Json": {
"type": "Transitive",
"resolved": "6.0.10",
"contentHash": "NSB0kDipxn2ychp88NXWfFRFlmi1bst/xynOutbnpEfRCT9JZkZ7KOmF/I/hNKo2dILiMGnqblm+j1sggdLB9g==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
"System.Text.Encodings.Web": "6.0.0"
}
},
"usbipd": {
"type": "Project",
"dependencies": {
Expand Down Expand Up @@ -498,6 +571,41 @@
"resolved": "2.0.0-beta4.22272.1",
"contentHash": "1uqED/q2H0kKoLJ4+hI2iPSBSEdTuhfCYADeJrAqERmiGQ2NNacYKRNEQ+gFbU4glgVyK8rxI+ZOe1onEtr/Pg=="
}
},
"net9.0-windows10.0.17763/win-x64": {
"Microsoft.Testing.Extensions.CodeCoverage": {
"type": "Direct",
"requested": "[17.12.6, )",
"resolved": "17.12.6",
"contentHash": "SYMv2ScahQUj2X7fM9yfZcg/jMmX4odGhuNV7DHNIJUQrQIueM1Xjco+nhv7YbuSaRYWuXV6W08r/dbdH0pq9g==",
"dependencies": {
"Microsoft.DiaSymReader": "2.0.0",
"Microsoft.Extensions.DependencyModel": "6.0.1",
"Microsoft.Testing.Platform": "1.4.0",
"System.Reflection.Metadata": "8.0.0"
}
},
"System.Diagnostics.EventLog": {
"type": "Transitive",
"resolved": "9.0.0",
"contentHash": "qd01+AqPhbAG14KtdtIqFk+cxHQFZ/oqRSCoxU1F+Q6Kv0cl726sl7RzU9yLFGd4BUOKdN4XojXF0pQf/R6YeA=="
},
"System.ServiceProcess.ServiceController": {
"type": "Transitive",
"resolved": "9.0.0",
"contentHash": "ciFstNZEWYf40HbwzdQLdgQpgpnjkleC1z0jMqBKRdkEQqQ6I/Aht0x9fTBODnaQTtcF+scvrdimoDbfNap/aQ==",
"dependencies": {
"System.Diagnostics.EventLog": "9.0.0"
}
},
"System.Text.Encodings.Web": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
}
}
}
}
3 changes: 2 additions & 1 deletion UsbIds/UsbIds.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ SPDX-License-Identifier: GPL-3.0-only
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<Platforms>AnyCPU</Platforms>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<IsRoslynComponent>true</IsRoslynComponent>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion Usbipd.Automation/Usbipd.Automation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ SPDX-License-Identifier: GPL-3.0-only
<PropertyGroup>
<TargetFrameworks>$(MainTargetFramework);netstandard2.0</TargetFrameworks>
<Platforms>AnyCPU</Platforms>
<Platform>AnyCPU</Platform>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 0 additions & 6 deletions Usbipd.Automation/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
"requested": "[6.0.5, )",
"resolved": "6.0.5",
"contentHash": "vjqDQVrYXbuokLtp5OryzvumVDF9THjpAiURAehKWEe2PEkxEzOQuedFdiSf9wChL6nxCRrL+rNZ5VhcDf6xYQ=="
},
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[9.0.0, )",
"resolved": "9.0.0",
"contentHash": "zAwp213evC3UkimtVXRb+Dlgc/40QG145nmZDtp2LO9zJJMfrp+i/87BnXN7tRXEA4liyzdFkjqG1HE8/RPb4A=="
}
}
}
Expand Down
Loading

0 comments on commit 2c154e9

Please sign in to comment.