Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate .NET 2.0 console and engine builds and update all .NET 4.0 builds to 4.6.2 #1235

Merged
merged 6 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
next-version: 3.14.0
next-version: 3.16.0
mode: ContinuousDelivery
legacy-semver-padding: 5
build-metadata-padding: 5
Expand Down
4 changes: 2 additions & 2 deletions NetFXTests.nunit
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<Settings processModel="Default" domainUsage="Default" />
<Config name="Debug" appbase="bin/Debug">
<assembly path="net35/mock-assembly.dll" />
<assembly path="net40/mock-assembly.dll" />
<assembly path="net462/mock-assembly.dll" />
</Config>
<Config name="Release" appbase="bin/Release">
<assembly path="net35/mock-assembly.dll" />
<assembly path="net40/mock-assembly.dll" />
<assembly path="net462/mock-assembly.dll" />
</Config>
</NUnitProject>
6 changes: 4 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ jobs:
# ArtifactName: Package

- job: Linux
condition: not(or(startsWith(variables['Build.SourceBranchName'], 'azure-windows-'),startsWith(variables['Build.SourceBranchName'], 'azure-macOS-')))
condition: false # temporarily disabled
# condition: not(or(startsWith(variables['Build.SourceBranchName'], 'azure-windows-'),startsWith(variables['Build.SourceBranchName'], 'azure-macOS-')))
pool:
vmImage: ubuntu-20.04
steps:
Expand Down Expand Up @@ -125,7 +126,8 @@ jobs:
condition: succeededOrFailed()

- job: macOS
condition: not(or(startsWith(variables['Build.SourceBranchName'], 'azure-windows-'),startsWith(variables['Build.SourceBranchName'], 'azure-linux-')))
condition: false # temporarily disabled
# condition: not(or(startsWith(variables['Build.SourceBranchName'], 'azure-windows-'),startsWith(variables['Build.SourceBranchName'], 'azure-linux-')))
pool:
vmImage: macOS-11
steps:
Expand Down
41 changes: 21 additions & 20 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ private void BuildEachProjectSeparately()
BuildProject(AGENT_PROJECT);
BuildProject(AGENT_X86_PROJECT);

BuildProject(ENGINE_TESTS_PROJECT, "net35", "netcoreapp2.1", "netcoreapp3.1");
BuildProject(ENGINE_CORE_TESTS_PROJECT, "net35", "netcoreapp2.1", "netcoreapp3.1", "net5.0", "net6.0");
BuildProject(CONSOLE_TESTS_PROJECT, "net35", "net6.0");
BuildProject(ENGINE_TESTS_PROJECT, "net462", "netcoreapp2.1", "netcoreapp3.1");
BuildProject(ENGINE_CORE_TESTS_PROJECT, "net462", "netcoreapp2.1", "netcoreapp3.1", "net5.0", "net6.0");
BuildProject(CONSOLE_TESTS_PROJECT, "net462", "net6.0");

BuildProject(MOCK_ASSEMBLY_X86_PROJECT, "net35", "net40", "netcoreapp2.1", "netcoreapp3.1");
BuildProject(MOCK_ASSEMBLY_X86_PROJECT, "net35", "net462", "netcoreapp2.1", "netcoreapp3.1");
BuildProject(NOTEST_PROJECT, "net35", "netcoreapp2.1", "netcoreapp3.1");


Expand Down Expand Up @@ -283,20 +283,20 @@ Task("TestNet60EngineCore")
.OnError(exception => { UnreportedErrors.Add(exception.Message); })
.Does(() =>
{
RunDotnetNUnitLiteTests(NETCORE_ENGINE_CORE_TESTS, "net6.0");
RunDotnetNUnitLiteTests(NETCORE_ENGINE_CORE_TESTS, NETCORE_ENGINE_TARGET);
});

//////////////////////////////////////////////////////////////////////
// TEST .NET 2.0 ENGINE
// TEST .NET 4.6.2 ENGINE
//////////////////////////////////////////////////////////////////////

Task("TestNet20Engine")
.Description("Tests the engine")
Task("TestNetFxEngine")
.Description("Tests the .NET Framework build of the engine")
.IsDependentOn("Build")
.OnError(exception => { UnreportedErrors.Add(exception.Message); })
.Does(() =>
{
RunNUnitLiteTests(NETFX_ENGINE_TESTS, "net35");
RunNUnitLiteTests(NETFX_ENGINE_TESTS, NETFX_ENGINE_TARGET);
});

//////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -326,23 +326,23 @@ Task("TestNetCore31Engine")
});

//////////////////////////////////////////////////////////////////////
// TEST .NET 2.0 CONSOLE
// TEST .NET FRAMEWORK CONSOLE
//////////////////////////////////////////////////////////////////////

Task("TestNet20Console")
.Description("Tests the .NET 2.0 console runner")
Task("TestNetFxConsole")
.Description("Tests the .NET 4.6.2 console runner")
.IsDependentOn("Build")
.OnError(exception => { UnreportedErrors.Add(exception.Message); })
.Does(() =>
{
RunNet20Console(CONSOLE_TESTS, "net35");
RunNetFxConsole(CONSOLE_TESTS, NETFX_CONSOLE_TARGET);
});

//////////////////////////////////////////////////////////////////////
// TEST .NET 6.0 CONSOLE
// TEST .NET CORE CONSOLE
//////////////////////////////////////////////////////////////////////

Task("TestNet60Console")
Task("TestNetCoreConsole")
.Description("Tests the .NET 6.0 console runner")
.IsDependentOn("Build")
.OnError(exception => { UnreportedErrors.Add(exception.Message); })
Expand Down Expand Up @@ -388,7 +388,7 @@ Task("CreateMsiImage")
MSI_IMG_DIR);
CopyDirectory(BIN_DIR, MSI_IMG_DIR + "bin/");

foreach (var framework in new[] { "net20", "net35" })
foreach (var framework in new[] { NETFX_CONSOLE_TARGET })
{
var addinsImgDir = MSI_IMG_DIR + "bin/" + framework + "/addins/";

Expand All @@ -414,7 +414,8 @@ Task("CreateZipImage")
ZIP_IMG_DIR);
CopyDirectory(BIN_DIR, ZIP_IMG_DIR + "bin/");

foreach (var framework in new[] { "net20", "net35" })
// Currently, only the .NET Framework runner accepts extensions
foreach (var framework in new[] { NETFX_CONSOLE_TARGET })
{
var frameworkDir = ZIP_IMG_DIR + "bin/" + framework + "/";
CopyFileToDirectory(ZIP_DIR + "nunit.bundle.addins", frameworkDir);
Expand Down Expand Up @@ -745,8 +746,8 @@ Task("CreateProductionRelease")

Task("TestConsole")
.Description("Builds and tests the console runner")
.IsDependentOn("TestNet20Console")
.IsDependentOn("TestNet60Console");
.IsDependentOn("TestNetFxConsole")
.IsDependentOn("TestNetCoreConsole");

Task("TestEngineCore")
.Description("Builds and tests the engine core assembly")
Expand All @@ -758,7 +759,7 @@ Task("TestEngineCore")

Task("TestEngine")
.Description("Builds and tests the engine assembly")
.IsDependentOn("TestNet20Engine")
.IsDependentOn("TestNetFxEngine")
.IsDependentOn("TestNetStandard20Engine")
.IsDependentOn("TestNetCore31Engine");

Expand Down
15 changes: 13 additions & 2 deletions cake/constants.cake
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,20 @@ var CONSOLE_TESTS_PROJECT = SOURCE_DIR + "NUnitConsole/nunit3-console.tests/nuni
var MOCK_ASSEMBLY_PROJECT = SOURCE_DIR + "NUnitEngine/mock-assembly/mock-assembly.csproj";
var MOCK_ASSEMBLY_X86_PROJECT = SOURCE_DIR + "NUnitEngine/mock-assembly-x86/mock-assembly-x86.csproj";
var NOTEST_PROJECT = SOURCE_DIR + "NUnitEngine/notest-assembly/notest-assembly.csproj";

// Console Runner
var NET20_CONSOLE = BIN_DIR + "net20/nunit3-console.exe";
var NET60_CONSOLE = BIN_DIR + "net6.0/nunit3-netcore-console.dll";
// We build two console runners. If version of either is upgraded, change it here
var NETFX_CONSOLE_TARGET = "net462";
var NETFX_CONSOLE_DIR = BIN_DIR + NETFX_CONSOLE_TARGET + "/";
var NETFX_CONSOLE = NETFX_CONSOLE_DIR + "nunit3-console.exe";
var NETCORE_CONSOLE_TARGET = "net6.0";
var NETCORE_CONSOLE_DIR = BIN_DIR + NETCORE_CONSOLE_TARGET + "/";
var NETCORE_CONSOLE = NETCORE_CONSOLE_DIR + "nunit3-netcore-console.dll";

// Currently, the engine uses the same versions as the console runner but this may not always be true
var NETFX_ENGINE_TARGET = NETFX_CONSOLE_TARGET;
var NETCORE_ENGINE_TARGET = NETCORE_CONSOLE_TARGET;

// Unit Tests
var NETFX_ENGINE_CORE_TESTS = "nunit.engine.core.tests.exe";
var NETCORE_ENGINE_CORE_TESTS = "nunit.engine.core.tests.dll";
Expand Down
31 changes: 15 additions & 16 deletions cake/package-definitions.cake
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void InitializePackageDefinitions(ICakeContext context)
HasFiles("LICENSE.txt", "NOTICES.txt"),
HasDirectory("tools").WithFiles(CONSOLE_FILES).AndFiles(ENGINE_FILES).AndFile("nunit.console.nuget.addins"),
HasDirectory("tools/agents/net20").WithFiles(AGENT_FILES).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/net40").WithFiles(AGENT_FILES).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/net462").WithFiles(AGENT_FILES).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/netcoreapp3.1").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/net5.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/net6.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"),
Expand All @@ -78,7 +78,7 @@ public void InitializePackageDefinitions(ICakeContext context)
symbols: new PackageCheck[] {
HasDirectory("tools").WithFiles(ENGINE_PDB_FILES).AndFile("nunit3-console.pdb"),
HasDirectory("tools/agents/net20").WithFiles(AGENT_PDB_FILES),
HasDirectory("tools/agents/net40").WithFiles(AGENT_PDB_FILES),
HasDirectory("tools/agents/net462").WithFiles(AGENT_PDB_FILES),
HasDirectory("tools/agents/netcoreapp3.1").WithFiles(AGENT_PDB_FILES_NETCORE),
HasDirectory("tools/agents/net5.0").WithFiles(AGENT_PDB_FILES_NETCORE),
HasDirectory("tools/agents/net6.0").WithFiles(AGENT_PDB_FILES_NETCORE),
Expand All @@ -94,12 +94,12 @@ public void InitializePackageDefinitions(ICakeContext context)
source: NUGET_DIR + "runners/nunit.console-runner.netcore.nuspec",
checks: new PackageCheck[] {
HasFiles("LICENSE.txt", "NOTICES.txt"),
HasDirectory("tools/net6.0/any").WithFiles(CONSOLE_FILES_NETCORE).AndFiles(ENGINE_FILES).AndFile("nunit.console.nuget.addins")
HasDirectory($"tools/{NETCORE_CONSOLE_TARGET}/any").WithFiles(CONSOLE_FILES_NETCORE).AndFiles(ENGINE_FILES).AndFile("nunit.console.nuget.addins")
},
symbols: new PackageCheck[] {
HasDirectory("tools/net6.0/any").WithFile("nunit3-netcore-console.pdb").AndFiles(ENGINE_PDB_FILES)
HasDirectory($"tools/{NETCORE_CONSOLE_TARGET}/any").WithFile("nunit3-netcore-console.pdb").AndFiles(ENGINE_PDB_FILES)
},
executable: "tools/net6.0/any/nunit3-netcore-console.exe",
executable: $"tools/{NETCORE_CONSOLE_TARGET}/any/nunit3-netcore-console.exe",
tests: NetCoreRunnerTests),

NUnitConsoleRunnerChocolateyPackage = new ChocolateyPackage(
Expand All @@ -110,7 +110,7 @@ public void InitializePackageDefinitions(ICakeContext context)
checks: new PackageCheck[] {
HasDirectory("tools").WithFiles("LICENSE.txt", "NOTICES.txt", "VERIFICATION.txt").AndFiles(CONSOLE_FILES).AndFiles(ENGINE_FILES).AndFile("nunit.choco.addins"),
HasDirectory("tools/agents/net20").WithFiles(AGENT_FILES).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/net40").WithFiles(AGENT_FILES).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/net462").WithFiles(AGENT_FILES).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/netcoreapp3.1").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/net5.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/net6.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"),
Expand All @@ -128,7 +128,7 @@ public void InitializePackageDefinitions(ICakeContext context)
HasDirectory("NUnit.org").WithFiles("LICENSE.txt", "NOTICES.txt", "nunit.ico"),
HasDirectory("NUnit.org/nunit-console").WithFiles(CONSOLE_FILES).AndFiles(ENGINE_FILES).AndFile("nunit.bundle.addins"),
HasDirectory("NUnit.org/nunit-console/agents/net20").WithFiles("nunit-agent.exe", "nunit-agent.exe.config"),
HasDirectory("NUnit.org/nunit-console/agents/net40").WithFiles("nunit-agent.exe", "nunit-agent.exe.config"),
HasDirectory("NUnit.org/nunit-console/agents/net462").WithFiles("nunit-agent.exe", "nunit-agent.exe.config"),
HasDirectory("NUnit.org/nunit-console/agents/netcoreapp3.1").WithFile("nunit-agent.dll"),
HasDirectory("NUnit.org/nunit-console/agents/net5.0").WithFile("nunit-agent.dll"),
HasDirectory("NUnit.org/nunit-console/agents/net6.0").WithFile("nunit-agent.dll"),
Expand All @@ -145,18 +145,17 @@ public void InitializePackageDefinitions(ICakeContext context)
source: ZIP_IMG_DIR,
checks: new PackageCheck[] {
HasFiles("LICENSE.txt", "NOTICES.txt", "CHANGES.txt"),
HasDirectory("bin/net20").WithFiles(CONSOLE_FILES).AndFiles(ENGINE_FILES).AndFile("nunit3-console.pdb").AndFiles(ENGINE_PDB_FILES),
HasDirectory("bin/net35").WithFiles(CONSOLE_FILES).AndFiles(ENGINE_FILES).AndFile("nunit3-console.pdb").AndFiles(ENGINE_PDB_FILES),
HasDirectory($"bin/{NETFX_CONSOLE_TARGET}").WithFiles(CONSOLE_FILES).AndFiles(ENGINE_FILES).AndFile("nunit3-console.pdb").AndFiles(ENGINE_PDB_FILES),
HasDirectory("bin/netstandard2.0").WithFiles(ENGINE_FILES).AndFiles(ENGINE_PDB_FILES),
HasDirectory("bin/netcoreapp2.1").WithFiles(ENGINE_FILES).AndFiles(ENGINE_PDB_FILES),
HasDirectory("bin/netcoreapp3.1").WithFiles(ENGINE_FILES).AndFiles(ENGINE_PDB_FILES),
//HasDirectory("bin/net5.0").WithFiles(ENGINE_FILES).AndFiles(ENGINE_PDB_FILES),
HasDirectory("bin/agents/net20").WithFiles(AGENT_FILES).AndFiles(AGENT_PDB_FILES),
HasDirectory("bin/agents/net40").WithFiles(AGENT_FILES).AndFiles(AGENT_PDB_FILES),
HasDirectory("bin/agents/net462").WithFiles(AGENT_FILES).AndFiles(AGENT_PDB_FILES),
HasDirectory("bin/agents/net5.0").WithFiles(AGENT_FILES_NETCORE).AndFiles(AGENT_PDB_FILES_NETCORE),
HasDirectory("bin/agents/net6.0").WithFiles(AGENT_FILES_NETCORE).AndFiles(AGENT_PDB_FILES_NETCORE)
},
executable: "bin/net20/nunit3-console.exe",
executable: $"bin/{NETFX_CONSOLE_TARGET}/nunit3-console.exe",
tests: StandardRunnerTests.Concat(new[] { NUnitProjectTest })),

// NOTE: Packages below this point have no direct tests
Expand All @@ -168,21 +167,21 @@ public void InitializePackageDefinitions(ICakeContext context)
source: NUGET_DIR + "engine/nunit.engine.nuspec",
checks: new PackageCheck[] {
HasFiles("LICENSE.txt", "NOTICES.txt"),
HasDirectory("lib/net20").WithFiles(ENGINE_FILES),
HasDirectory($"lib/{NETFX_ENGINE_TARGET}").WithFiles(ENGINE_FILES),
HasDirectory("lib/netstandard2.0").WithFiles(ENGINE_FILES),
HasDirectory("lib/netcoreapp3.1").WithFiles(ENGINE_FILES),
HasDirectory("contentFiles/any/lib/net20").WithFile("nunit.engine.nuget.addins"),
HasDirectory($"contentFiles/any/lib/{NETFX_ENGINE_TARGET}").WithFile("nunit.engine.nuget.addins"),
HasDirectory("contentFiles/any/lib/netstandard2.0").WithFile("nunit.engine.nuget.addins"),
HasDirectory("contentFiles/any/lib/netcoreapp3.1").WithFile("nunit.engine.nuget.addins"),
HasDirectory("contentFiles/any/agents/net20").WithFiles(AGENT_FILES).AndFile("nunit.agent.addins"),
HasDirectory("contentFiles/any/agents/net40").WithFiles(AGENT_FILES).AndFile("nunit.agent.addins")
HasDirectory("contentFiles/any/agents/net462").WithFiles(AGENT_FILES).AndFile("nunit.agent.addins")
},
symbols: new PackageCheck[] {
HasDirectory("lib/net20").WithFiles(ENGINE_PDB_FILES),
HasDirectory($"lib/{NETFX_ENGINE_TARGET}").WithFiles(ENGINE_PDB_FILES),
HasDirectory("lib/netstandard2.0").WithFiles(ENGINE_PDB_FILES),
HasDirectory("lib/netcoreapp3.1").WithFiles(ENGINE_PDB_FILES),
HasDirectory("contentFiles/any/agents/net20").WithFiles(AGENT_PDB_FILES),
HasDirectory("contentFiles/any/agents/net40").WithFiles(AGENT_PDB_FILES)
HasDirectory("contentFiles/any/agents/net462").WithFiles(AGENT_PDB_FILES)
}),

NUnitEngineApiPackage = new NuGetPackage(
Expand Down
2 changes: 1 addition & 1 deletion cake/package-tester.cake
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class PackageTester
// copying certain files to their final destination.
Console.WriteLine("Copying agent files");
_context.CopyFiles(filesToCopy, binDir + "agents/net20");
_context.CopyFiles(filesToCopy, binDir + "agents/net40");
_context.CopyFiles(filesToCopy, binDir + "agents/net462");
}
}
else
Expand Down
8 changes: 4 additions & 4 deletions cake/package-tests.cake
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ static PackageTest Net35X86Test = new PackageTest(
static PackageTest Net40Test = new PackageTest(
"Net40Test",
"Run mock-assembly.dll under .NET 4.x",
"net40/mock-assembly.dll",
"net462/mock-assembly.dll",
MockAssemblyExpectedResult(1));

static PackageTest Net40X86Test = new PackageTest(
"Net40X86Test",
"Run mock-assembly-x86.dll under .NET 4.x",
"net40/mock-assembly-x86.dll",
"net462/mock-assembly-x86.dll",
MockAssemblyExpectedResult(1));

static PackageTest Net35PlusNet40Test = new PackageTest(
"Net35PlusNet40Test",
"Run both copies of mock-assembly together",
"net35/mock-assembly.dll net40/mock-assembly.dll",
"net35/mock-assembly.dll net462/mock-assembly.dll",
MockAssemblyExpectedResult(2));

static PackageTest Net60Test = new PackageTest(
Expand Down Expand Up @@ -99,7 +99,7 @@ static PackageTest NetCore21PlusNetCore31PlusNet50PlusNet60Test = new PackageTes
static PackageTest Net40PlusNet60Test = new PackageTest(
"Net40PlusNet60Test",
"Run mock-assembly under .Net Framework 4.0 and .Net 6.0 together",
"net40/mock-assembly.dll net6.0/mock-assembly.dll",
"net462/mock-assembly.dll net6.0/mock-assembly.dll",
MockAssemblyExpectedResult(2));

static PackageTest NUnitProjectTest;
Expand Down
6 changes: 3 additions & 3 deletions cake/utilities.cake
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,14 @@ void RunDotnetNUnitLiteTests(string testAssembly, string targetRuntime)
UnreportedErrors.Add($"{testAssembly}({targetRuntime}) returned rc = {rc}");
}

void RunNet20Console(string testAssembly, string targetRuntime)
void RunNetFxConsole(string testAssembly, string targetRuntime)
{
var workingDir = BIN_DIR + targetRuntime + "/";
var assemblyPath = workingDir + testAssembly;
var resultPath = GetResultXmlPath(assemblyPath, targetRuntime).FullPath;

int rc = StartProcess(
NET20_CONSOLE,
NETFX_CONSOLE,
new ProcessSettings()
{
Arguments = $"\"{assemblyPath}\" --result:{resultPath}",
Expand All @@ -180,7 +180,7 @@ void RunNetCoreConsole(string testAssembly, string targetRuntime)
"dotnet",
new ProcessSettings
{
Arguments = $"\"{NET60_CONSOLE}\" \"{assemblyPath}\" --result:{resultPath}",
Arguments = $"\"{NETCORE_CONSOLE}\" \"{assemblyPath}\" --result:{resultPath}",
WorkingDirectory = workingDir
});

Expand Down
Loading