diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 03fd6b87ee..5d889b92e3 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -110,10 +110,7 @@ jobs: run: dotnet build -c Release - name: Publish AOT - run: dotnet publish TUnit.TestProject/TUnit.TestProject.csproj -c Release --use-current-runtime -p:Aot=true -o TESTPROJECT_AOT --framework net8.0 - - - name: Publish Single File - run: dotnet publish TUnit.TestProject/TUnit.TestProject.csproj -c Release --use-current-runtime -p:SingleFile=true -o TESTPROJECT_SINGLEFILE --framework net8.0 + run: dotnet publish TUnit.TestProject/TUnit.TestProject.csproj -c Release --use-current-runtime -p:Aot=true -o TESTPROJECT_AOT --framework net10.0 - name: Run Pipeline uses: ./.github/actions/execute-pipeline diff --git a/TUnit.Engine.Tests/Enums/TestMode.cs b/TUnit.Engine.Tests/Enums/TestMode.cs index 2ad322191d..886e9f36f8 100644 --- a/TUnit.Engine.Tests/Enums/TestMode.cs +++ b/TUnit.Engine.Tests/Enums/TestMode.cs @@ -5,5 +5,4 @@ public enum TestMode SourceGenerated, Reflection, AOT, - SingleFileApplication, } diff --git a/TUnit.Engine.Tests/ExternalCancellationTests.cs b/TUnit.Engine.Tests/ExternalCancellationTests.cs index ec08ba2f92..dcb77f7327 100644 --- a/TUnit.Engine.Tests/ExternalCancellationTests.cs +++ b/TUnit.Engine.Tests/ExternalCancellationTests.cs @@ -73,13 +73,12 @@ private async Task RunTestWithExternalCancellation(string filter, string markerF .WithWorkingDirectory(testProject.DirectoryName!) .WithValidation(CommandResultValidation.None), - // Skip AOT and SingleFile modes for external cancellation (only test in CI) + // Skip AOT mode for external cancellation (only test in CI) TestMode.AOT => null, - TestMode.SingleFileApplication => null, _ => throw new ArgumentOutOfRangeException(nameof(testMode), testMode, null) }; - // Skip AOT and SingleFile modes + // Skip AOT mode if (command == null) { return; diff --git a/TUnit.Engine.Tests/InvokableTestBase.cs b/TUnit.Engine.Tests/InvokableTestBase.cs index d63ea664ac..cc79286535 100644 --- a/TUnit.Engine.Tests/InvokableTestBase.cs +++ b/TUnit.Engine.Tests/InvokableTestBase.cs @@ -19,7 +19,6 @@ public static IEnumerable GetTestModes() if (!EnvironmentVariables.IsNetFramework) { yield return TestMode.AOT; - yield return TestMode.SingleFileApplication; } } @@ -43,7 +42,6 @@ protected Task RunTestsWithFilter(string filter, TestMode.SourceGenerated => RunWithoutAot(filter, assertions, runOptions, assertionExpression), TestMode.Reflection => RunWithoutAot(filter, assertions, runOptions.WithArgument("--reflection"), assertionExpression), TestMode.AOT => RunWithAot(filter, assertions, runOptions, assertionExpression), - TestMode.SingleFileApplication => RunWithSingleFile(filter, assertions, runOptions, assertionExpression), _ => throw new ArgumentOutOfRangeException(nameof(testMode), testMode, null) }; } @@ -52,15 +50,17 @@ private async Task RunWithoutAot(string filter, List> assertions, RunOptions runOptions, string assertionExpression) { var testProject = Sourcy.DotNet.Projects.TUnit_TestProject; + var projectName = Path.GetFileNameWithoutExtension(testProject.Name); + var binDir = new DirectoryInfo(Path.Combine(testProject.DirectoryName!, "bin", "Release", GetEnvironmentVariable)); + + var executable = binDir.EnumerateFiles(projectName).FirstOrDefault() + ?? binDir.EnumerateFiles(projectName + ".exe").First(); + var guid = Guid.NewGuid().ToString("N"); var trxFilename = guid + ".trx"; - var command = Cli.Wrap("dotnet") + var command = Cli.Wrap(executable.FullName) .WithArguments( [ - "run", - "--no-build", - "-f", GetEnvironmentVariable, - "--configuration", "Release", "--treenode-filter", filter, "--report-trx", "--report-trx-filename", trxFilename, "--diagnostic-verbosity", "Debug", @@ -110,40 +110,6 @@ private async Task RunWithAot(string filter, List> assertions, await RunWithFailureLogging(command, runOptions, trxFilename, assertions, assertionExpression); } - private async Task RunWithSingleFile(string filter, - List> assertions, RunOptions runOptions, string assertionExpression) - { - if (Environment.GetEnvironmentVariable("GITHUB_ACTIONS") != "true") - { - return; - } - - var files = FindFolder(x => x.Name == "TESTPROJECT_SINGLEFILE")! - .EnumerateFiles("*", SearchOption.AllDirectories) - .ToArray(); - - var aotApp = files.FirstOrDefault(x => x.Name == "TUnit.TestProject") - ?? files.First(x => x.Name == "TUnit.TestProject.exe"); - - var guid = Guid.NewGuid().ToString("N"); - var trxFilename = guid + ".trx"; - - var command = Cli.Wrap(aotApp.FullName) - .WithArguments( - [ - "--treenode-filter", filter, - "--report-trx", "--report-trx-filename", trxFilename, - "--diagnostic-verbosity", "Debug", - "--diagnostic", "--diagnostic-file-prefix", $"log_{GetType().Name}_SINGLEFILE_", - "--timeout", "5m", - ..runOptions.AdditionalArguments - ] - ) - .WithValidation(CommandResultValidation.None); - - await RunWithFailureLogging(command, runOptions, trxFilename, assertions, assertionExpression); - } - protected static FileInfo? FindFile(Func predicate) { return FileSystemHelpers.FindFile(predicate);