4747 $run_settings_args = 'NUnit.DefaultTestNamePattern="{C}:{m}{a}" RunConfiguration.TargetPlatform=${{inputs.architecture}}';
4848 "run_settings_args=$run_settings_args" | Out-File -FilePath $env:GITHUB_OUTPUT -Append;
4949
50- $vstest = "--logger:trx --logger:'console;verbosity=normal' --blame";
51- "vstest=$vstest" | Out-File -FilePath $env:GITHUB_OUTPUT -Append;
52-
53- $dotnet = "-l trx -l 'console;verbosity=normal' --blame";
54- "dotnet=$dotnet" | Out-File -FilePath $env:GITHUB_OUTPUT -Append;
55-
5650 $target_framework = "${{inputs.target_framework}}";
5751 $target_frameworks = "${{inputs.target_framework_array}}";
5852 if ($target_frameworks -eq '') {
@@ -61,36 +55,53 @@ runs:
6155 "target_frameworks=$target_frameworks" | Out-File -FilePath $env:GITHUB_OUTPUT -Append;
6256 shell : pwsh
6357
58+ - name : Clean TestResults (Windows)
59+ if : runner.os == 'Windows'
60+ run : |
61+ if (Test-Path "TestResults") {
62+ Remove-Item -Path "TestResults" -Recurse -Force
63+ }
64+ New-Item -Path "TestResults" -ItemType Directory
65+ shell : pwsh
66+
67+ - name : Clean TestResults (Unix)
68+ if : runner.os != 'Windows'
69+ run : |
70+ rm -rf TestResults
71+ mkdir -p TestResults
72+ shell : bash
73+
6474 - name : Build if required
6575 if : ${{inputs.manual_build == 'true'}}
6676 run : |
6777 foreach ($target_framework in ConvertFrom-Json "${{steps.test-args.outputs.target_frameworks}}") {
68- dotnet build HarmonyTests/HarmonyTests.csproj -c ${{inputs.build_configuration}} -f $target_framework;
78+ dotnet build HarmonyTests/HarmonyTests.csproj -c ${{inputs.build_configuration}} -f $target_framework
6979 }
7080 shell : pwsh
7181
7282 - name : Perform Tests Windows FX/Mono
7383 if : ${{inputs.os == 'windows' && (inputs.runtime-type == 'fx' || inputs.runtime-type == 'mono')}}
7484 run : |
75- $mono = "${{steps.get-program-files.outputs.path}}/Mono/bin/mono.exe";
85+ $mono = "${{steps.get-program-files.outputs.path}}/Mono/bin/mono.exe"
7686
77- $vspath = vswhere -latest -property installationPath;
78- $vstest = join-path $vspath "Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe";
87+ $vspath = vswhere -latest -property installationPath
88+ $vstest = join-path $vspath "Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"
7989
8090 foreach ($target_framework in ConvertFrom-Json "${{steps.test-args.outputs.target_frameworks}}") {
81- & ${{(inputs.runtime-type == 'mono' && '"$mono"') || ''}} "$vstest" "HarmonyTests/bin/${{inputs.build_configuration}}/$target_framework/HarmonyTests.dll" --framework:$target_framework ${{steps.test-args.outputs.vstest}} -- ${{steps.test-args.outputs.run_settings_args}};
91+ $trxFileName = "${{inputs.os}}-${{inputs.architecture}}-${{inputs.runtime-type}}-${{inputs.build_configuration}}-$target_framework.trx"
92+ & ${{(inputs.runtime-type == 'mono' && '"$mono"') || ''}} "$vstest" "HarmonyTests/bin/${{inputs.build_configuration}}/$target_framework/HarmonyTests.dll" --framework:$target_framework --logger:"trx;LogFileName=../TestResults/$trxFileName" --logger:"console;verbosity=normal" --blame -- ${{steps.test-args.outputs.run_settings_args}}
8293 }
8394 shell : pwsh
8495
8596 - name : Perform Tests Windows .NET | Ubuntu .NET/Mono
8697 if : ${{(inputs.os == 'windows' && inputs.runtime-type == 'dotnet') || inputs.os == 'ubuntu'}}
8798 run : |
8899 foreach ($target_framework in ConvertFrom-Json "${{steps.test-args.outputs.target_frameworks}}") {
89- dotnet test "HarmonyTests/bin/${{inputs.build_configuration}}/$target_framework/HarmonyTests.dll" -f $target_framework ${{steps.test-args.outputs.dotnet}} -- ${{steps.test-args.outputs.run_settings_args}};
100+ $trxFileName = "${{inputs.os}}-${{inputs.architecture}}-${{inputs.runtime-type}}-${{inputs.build_configuration}}-$target_framework.trx"
101+ dotnet test "HarmonyTests/bin/${{inputs.build_configuration}}/$target_framework/HarmonyTests.dll" -f $target_framework --logger:"trx;LogFileName=../TestResults/$trxFileName" --logger:"console;verbosity=normal" -- ${{steps.test-args.outputs.run_settings_args}}
90102 }
91103 shell : pwsh
92104
93- # Not sure if continue_on_error: true is needed
94105 - name : Perform Tests MacOS/MacOS-arm64 .NET/Mono
95106 uses : nick-fields/retry@v3
96107 if : ${{inputs.os == 'macos' || inputs.os == 'macos-arm64'}}
@@ -100,12 +111,13 @@ runs:
100111 retry_on : timeout
101112 command : |
102113 if ('${{inputs.os == 'macos-arm64' && inputs.architecture == 'x64' && inputs.runtime-type == 'dotnet'}}' -eq 'true') {
103- $dotnet = '/Users/runner/.dotnet/x64/dotnet';
114+ $dotnet = '/Users/runner/.dotnet/x64/dotnet'
104115 } else {
105- $dotnet = '/Users/runner/.dotnet/dotnet';
116+ $dotnet = '/Users/runner/.dotnet/dotnet'
106117 }
107118 foreach ($target_framework in ConvertFrom-Json "${{steps.test-args.outputs.target_frameworks}}") {
108- & $dotnet test "HarmonyTests/bin/${{inputs.build_configuration}}/$target_framework/HarmonyTests.dll" -f $target_framework ${{steps.test-args.outputs.dotnet}} -- ${{steps.test-args.outputs.run_settings_args}};
119+ $trxFileName = "${{inputs.os}}-${{inputs.architecture}}-${{inputs.runtime-type}}-${{inputs.build_configuration}}-$target_framework.trx"
120+ & $dotnet test "HarmonyTests/bin/${{inputs.build_configuration}}/$target_framework/HarmonyTests.dll" -f $target_framework --logger:"trx;LogFileName=../TestResults/$trxFileName" --logger:"console;verbosity=normal" -- ${{steps.test-args.outputs.run_settings_args}}
109121 }
110122 shell : pwsh
111123
0 commit comments