Skip to content

Commit

Permalink
Switch to using dotnet test as the test runner (#420)
Browse files Browse the repository at this point in the history
* Exclude the SIL.LCModel.Utils.Tests.dll since that is a utility dll
  that has tests in it
  • Loading branch information
jasonleenaylor authored Dec 11, 2024
1 parent 2dcbbb7 commit a80711d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
with:
files: '**/TestResults.xml'
files: '**/*TestResults.trx'

- name: Create NuGet packages
shell: cmd
Expand Down
30 changes: 8 additions & 22 deletions build/FLExBridge.proj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build;Pack">
<PropertyGroup>
<RootDir Condition="'$(teamcity_build_checkoutDir)' == '' And '$(RootDir)'==''">$(MSBuildProjectDirectory)/..</RootDir>
<RootDir Condition="'$(teamcity_build_checkoutDir)' != ''">$(teamcity_build_checkoutDir)</RootDir>
<RootDir>$(MSBuildProjectDirectory)/..</RootDir>
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
<Platform>Any CPU</Platform>
<Solution>FLExBridge.sln</Solution>
Expand All @@ -10,24 +9,19 @@
<BUILD_VCS_NUMBER Condition="'$(BUILD_VCS_NUMBER)' == ''">0</BUILD_VCS_NUMBER>
<BUILD_NUMBER Condition="'$(BUILD_NUMBER)' == ''">0</BUILD_NUMBER>
<ExtraExcludeCategories Condition="'$(OS)'!='Windows_NT'">KnownMonoIssue,UnknownMonoIssue</ExtraExcludeCategories>
<ExtraExcludeCategories Condition="'$(teamcity_version)' != ''">SkipOnTeamCity,$(ExtraExcludeCategories)</ExtraExcludeCategories>
<ExtraExcludeCategories Condition="'$(GITHUB_ACTIONS)' != ''">SkipOnCI,$(ExtraExcludeCategories)</ExtraExcludeCategories>
<Release Condition="'$(Release)' == ''">true</Release>
<PalasoVer4LinuxGecko Condition="'$(OS)'!='Windows_NT'">10.0.0-beta0081</PalasoVer4LinuxGecko>
<GitVersionMsBuildProps>$(RootDir)/packages/GitVersion.MsBuild/build/GitVersion.MsBuild.props</GitVersionMsBuildProps>
<GitVersionMsBuildTargets>$(RootDir)/packages/GitVersion.MsBuild/build/GitVersion.MsBuild.targets</GitVersionMsBuildTargets>
<SILBuildTasksDLL>$(RootDir)/packages/SIL.BuildTasks/tools/SIL.BuildTasks.dll</SILBuildTasksDLL>
<SILReleaseTasksProps>$(RootDir)/packages/SIL.ReleaseTasks/build/SIL.ReleaseTasks.props</SILReleaseTasksProps>
<NUnitToolsDir>$(RootDir)/packages/NUnit.ConsoleRunner/tools</NUnitToolsDir>
<NUnitConsoleRunner>$(NUnitToolsDir)/nunit3-console.exe</NUnitConsoleRunner>
<BuildDependencyTasksDLL>$(RootDir)/packages/BuildDependencyTasks/BuildDependencyTasks.dll</BuildDependencyTasksDLL>
<RestartBuild Condition="!Exists('$(GitVersionMsBuildProps)') Or !Exists('$(GitVersionMsBuildTargets)') Or !Exists('$(SILBuildTasksDLL)') Or !Exists('$(SILReleaseTasksProps)') Or !Exists('$(NUnitConsoleRunner)') Or !Exists('$(BuildDependencyTasksDLL)')">true</RestartBuild>
<RestartBuild Condition="Exists('$(GitVersionMsBuildProps)') And Exists('$(GitVersionMsBuildTargets)') And Exists('$(SILBuildTasksDLL)') And Exists('$(SILReleaseTasksProps)') And Exists('$(NUnitConsoleRunner)') And Exists('$(BuildDependencyTasksDLL)')">false</RestartBuild>
<IgnoreGitVersionTask Condition="'$(IgnoreGitVersionTask)' == ''">false</IgnoreGitVersionTask>
<MSBuildTasksTargets>$(RootDir)/packages/MSBuildTasks.1.5.0.235/tools/MSBuild.Community.Tasks.Targets</MSBuildTasksTargets>
<GetVersion Condition="'$(GetVersion)' == ''">true</GetVersion>
<WriteVersionInfoToBuildLog Condition="'$(WriteVersionInfoToBuildLog)' == ''">true</WriteVersionInfoToBuildLog>
<TeamCity Condition="'$(teamcity_version)' != ''">true</TeamCity>
<TeamCity Condition="'$(teamcity_version)' == ''">false</TeamCity>
<!-- note this does not set the TargetFramework for the csproj files, it's just used as a variable to configure build paths-->
<TargetFramework Condition="'$(TargetFramework)' == ''">net462</TargetFramework>
</PropertyGroup>
Expand All @@ -44,9 +38,6 @@
<UsingTask TaskName="Split" AssemblyFile="$(SILBuildTasksDLL)" Condition="Exists('$(SILBuildTasksDLL)')"/>
<UsingTask TaskName="SIL.BuildTasks.FileUpdate" AssemblyFile="$(SILBuildTasksDLL)" Condition="Exists('$(SILBuildTasksDLL)')"/>
<UsingTask TaskName="MakeWixForDirTree" AssemblyFile="$(SILBuildTasksDLL)" Condition="Exists('$(SILBuildTasksDLL)') And '$(OS)'=='Windows_NT'"/>
<UsingTask TaskName="NUnit3"
AssemblyFile="$(SILBuildTasksDLL)"
Condition="Exists('$(SILBuildTasksDLL)')" />

<!-- a few do-nothing targets to get rid of some warnings from GitVersion.MsBuild.targets -->
<Target Name="GetAssemblyVersion"/>
Expand Down Expand Up @@ -203,19 +194,14 @@

<Target Name="TestOnly">
<ItemGroup>
<TestAssemblies Include="$(RootDir)/output/$(Configuration)/$(TargetFramework)/*Tests.dll" />
<!-- Include test assemblies and exclude unwanted ones -->
<TestAssemblies Include="$(RootDir)/output/$(Configuration)/$(TargetFramework)/*Tests.dll"
Exclude="**/SIL.LCModel.Utils.Tests.dll" />
</ItemGroup>

<NUnit3 Assemblies="@(TestAssemblies)"
ToolPath="$(NUnitToolsDir)"
TestInNewThread="false"
ExcludeCategory="$(ExtraExcludeCategories)"
WorkingDirectory="$(RootDir)/output/$(Configuration)/$(TargetFramework)"
Process="single"
Verbose="true"
UseNUnit3Xml="false"
OutputXmlFile="$(RootDir)/output/$(Configuration)/$(TargetFramework)/TestResults.xml"
TeamCity="$(TeamCity)"/>
<!-- Loop over each TestAssembly and execute dotnet test -->
<Exec Command="dotnet test --no-build --verbosity detailed --logger &quot;trx;LogFileName=%(TestAssemblies.Filename)TestResults.trx&quot; --filter &quot;TestCategory!=$(ExtraExcludeCategories)&quot; &quot;%(TestAssemblies.FullPath)&quot;"
Condition="Exists('%(TestAssemblies.FullPath)')" />
</Target>

<Target Name="Pack" DependsOnTargets="RestorePackages">
Expand Down

0 comments on commit a80711d

Please sign in to comment.