Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/nuget/TestCentric.Metadata-3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
OsirisTerje committed Apr 8, 2024
2 parents da1d13a + 143b8fc commit a8c0b2e
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 216 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/NUnit3TestAdapter.Cake.CI.yml
@@ -1,6 +1,6 @@
name: NUnit3TestAdapter.Cake.CI

on: [push, pull_request]
on: [push, pull_request,workflow_dispatch]

jobs:
build:
Expand All @@ -9,13 +9,14 @@ jobs:

steps:
- uses: actions/checkout@v4.1.1
- uses: actions/setup-dotnet@v2
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
7.0.x
8.0.x
- name: Build with cake
run: .\build.ps1 -t CI
shell: pwsh
2 changes: 0 additions & 2 deletions NUnit3TestAdapter.sln
Expand Up @@ -7,8 +7,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
.gitignore = .gitignore
.runsettings = .runsettings
appveyor.yml = appveyor.yml
azure-pipelines.yml = azure-pipelines.yml
build.cake = build.cake
build.cmd = build.cmd
build.ps1 = build.ps1
Expand Down
11 changes: 10 additions & 1 deletion azure-pipelines.yml
Expand Up @@ -21,6 +21,10 @@ jobs:
displayName: Install .NET Core 7.0 sdk
inputs:
version: 7.x
- task: UseDotNet@2
displayName: Install .NET Core 8.0 sdk
inputs:
version: 8.x
- task: UseDotNet@2
displayName: Install .NET Core 3.1 runtime
inputs:
Expand All @@ -44,6 +48,11 @@ jobs:
inputs:
version: 7.x

- task: UseDotNet@2
displayName: Install .NET Core 8.0 sdk
inputs:
version: 8.x

- task: UseDotNet@2
displayName: Install .NET Core 5.0 runtime
inputs:
Expand All @@ -56,5 +65,5 @@ jobs:
packageType: runtime
version: 3.1.x

- powershell: .\build.ps1 --target=Acceptance --configuration=$(BuildConfiguration)
- powershell: .\build.ps1 --target=test --configuration=$(BuildConfiguration)
displayName: Build and test
48 changes: 2 additions & 46 deletions build.cake
@@ -1,5 +1,5 @@
#tool vswhere&version=3.1.1
#tool Microsoft.TestPlatform&version=17.7.2
#tool vswhere&version=3.1.7
#tool Microsoft.TestPlatform&version=17.9.0

//////////////////////////////////////////////////////////////////////
// ARGUMENTS
Expand All @@ -20,43 +20,6 @@ var modifier = "-beta.1";
var dbgSuffix = configuration.ToLower() == "debug" ? "-dbg" : "";
var packageVersion = version + modifier + dbgSuffix;
Information("Packageversion: "+packageVersion);
if (BuildSystem.IsRunningOnAppVeyor)
{
var tag = AppVeyor.Environment.Repository.Tag;

if (tag.IsTag)
{
packageVersion = tag.Name;
}
else
{
var buildNumber = AppVeyor.Environment.Build.Number.ToString("00000");
var branch = AppVeyor.Environment.Repository.Branch.Replace(".", "").Replace("/", "");
var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest;

if (branch == "master" && !isPullRequest)
{
packageVersion = version + "-dev-" + buildNumber + dbgSuffix;
}
else
{
var suffix = "-ci-" + buildNumber + dbgSuffix;

if (isPullRequest)
suffix += "-pr-" + AppVeyor.Environment.PullRequest.Number;
else
suffix += "-" + System.Text.RegularExpressions.Regex.Replace(branch, "[^0-9A-Za-z-]+", "-");

// Nuget limits "special version part" to 20 chars. Add one for the hyphen.
if (suffix.Length > 21)
suffix = suffix.Substring(0, 21);

packageVersion = version + suffix;
}
}

AppVeyor.UpdateBuildVersion(packageVersion);
}

var packageName = "NUnit3TestAdapter-" + packageVersion;

Expand Down Expand Up @@ -349,13 +312,6 @@ Task("CI")
.IsDependentOn("Package")
.IsDependentOn("Acceptance");

Task("Appveyor")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependentOn("Package")
.IsDependentOn("Acceptance");


Task("Default")
.IsDependentOn("Build");

Expand Down
96 changes: 94 additions & 2 deletions src/NUnit.TestAdapter.Tests.Acceptance/AcceptanceTests.cs
Expand Up @@ -3,6 +3,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;

using NUnit.Framework;
using NUnit.Framework.Interfaces;
Expand All @@ -16,6 +17,7 @@ public class Frameworks
public const string Net50 = "net5.0";
public const string Net60 = "net6.0";
public const string Net70 = "net7.0";
public const string Net80 = "net8.0";
}

[Category("Acceptance")]
Expand All @@ -28,20 +30,110 @@ public abstract class AcceptanceTests
public const string LowestNetfxTarget = "net462";
public const string LegacyProjectTargetFrameworkVersion = "v4.6.2";

public static IEnumerable<string> TargetFrameworks => new[]
protected static IEnumerable<string> TargetFrameworks => new[]
{
LowestNetfxTarget,
Frameworks.NetCoreApp31
};

public static IEnumerable<string> DotNetCliTargetFrameworks => new[]
protected static IEnumerable<string> DotNetCliTargetFrameworks => new[]
{
Frameworks.NetCoreApp31,
Frameworks.Net50,
Frameworks.Net60,
Frameworks.Net70
};

protected static IEnumerable<string> ModernDotNetCliTargetFrameworks => new[]
{
Frameworks.Net60,
Frameworks.Net70,
Frameworks.Net80
};

protected static string NUnit3 => "3.*";
protected static string NUnit4 => "4.*";

public class MultiFrameworkSource
{
public IEnumerable<string> Frameworks { get; set; } = DotNetCliTargetFrameworks;
public string NUnitVersion { get; set; } = NUnit3;

public static IEnumerable<MultiFrameworkSource> LegacyDotNetFrameworks => new List<MultiFrameworkSource> { new() };

public static IEnumerable<MultiFrameworkSource> ModernDotNetFrameworks => new List<MultiFrameworkSource>
{
new ()
{
Frameworks = ModernDotNetCliTargetFrameworks,
NUnitVersion = NUnit4
}
};

public static IEnumerable<MultiFrameworkSource> NetFxFrameworks => new List<MultiFrameworkSource>
{
new ()
{
Frameworks = new List<string> { LowestNetfxTarget },
NUnitVersion = NUnit4
}
};

public static IEnumerable<MultiFrameworkSource> AllFrameworks => LegacyDotNetFrameworks.Concat(ModernDotNetFrameworks).Concat(NetFxFrameworks);
}

public class SingleFrameworkSource
{
public string Framework { get; set; } = LowestNetfxTarget;
public string NUnitVersion { get; set; } = NUnit4;

public static IEnumerable<SingleFrameworkSource> NetFxFramework => new List<SingleFrameworkSource> { new() };

public static IEnumerable<SingleFrameworkSource> LegacyDotNetFramework => new List<SingleFrameworkSource>
{
new ()
{
Framework = Frameworks.NetCoreApp31,
NUnitVersion = NUnit3
},
new ()
{
Framework = Frameworks.Net50,
NUnitVersion = NUnit3
}
};

public static IEnumerable<SingleFrameworkSource> ModernDotNetFramework => new List<SingleFrameworkSource>
{
new ()
{
Framework = Frameworks.Net60,
NUnitVersion = NUnit4
},
new ()
{
Framework = Frameworks.Net70,
NUnitVersion = NUnit4
},
new ()
{
Framework = Frameworks.Net80,
NUnitVersion = NUnit4
}
};

public static IEnumerable<SingleFrameworkSource> AllFrameworks => NetFxFramework.Concat(LegacyDotNetFramework).Concat(ModernDotNetFramework);
public static IEnumerable<SingleFrameworkSource> AllFrameworksExceptNetFx => LegacyDotNetFramework.Concat(ModernDotNetFramework);
}

protected string NUnitVersion(string targetFramework) =>
targetFramework switch
{
Frameworks.NetCoreApp31
or Frameworks.Net50 => NUnit3,
_ => NUnit4,
};

private static readonly Lazy<(IsolatedWorkspaceManager Manager, string NupkgVersion, bool KeepWorkspaces)> Initialization = new(() =>
{
var directory = TestContext.Parameters["ProjectWorkspaceDirectory"]
Expand Down
Expand Up @@ -19,7 +19,7 @@ public static void User_tests_get_the_version_of_Mono_Cecil_referenced_from_the_
<ItemGroup>
<PackageReference Include='Microsoft.NET.Test.Sdk' Version='*' />
<PackageReference Include='Mono.Cecil' Version='0.10.0-beta5' />
<PackageReference Include='NUnit' Version='*' />
<PackageReference Include='NUnit' Version='3.*' />
<PackageReference Include='NUnit3TestAdapter' Version='{NuGetPackageVersion}' />
</ItemGroup>
Expand Down Expand Up @@ -72,7 +72,7 @@ public static void Engine_uses_its_bundled_version_of_Mono_Cecil_instead_of_the_
<ItemGroup>
<PackageReference Include='Microsoft.NET.Test.Sdk' Version='*' />
<PackageReference Include='Mono.Cecil' Version='0.10.0' />
<PackageReference Include='NUnit' Version='*' />
<PackageReference Include='NUnit' Version='3.*' />
<PackageReference Include='NUnit3TestAdapter' Version='{NuGetPackageVersion}' />
</ItemGroup>
<ItemGroup Condition=""'$(TargetFrameworkIdentifier)' == '.NETFramework'"">
Expand Down
Expand Up @@ -21,7 +21,7 @@ protected IsolatedWorkspace CreateTestWorkspace(string framework)
<ItemGroup>
<PackageReference Include='Microsoft.NET.Test.Sdk' Version='*' />
<PackageReference Include='NUnit' Version='*' />
<PackageReference Include='NUnit' Version='{NUnitVersion(framework)}' />
<PackageReference Include='NUnit3TestAdapter' Version='{NuGetPackageVersion}' />
</ItemGroup>
Expand Down

0 comments on commit a8c0b2e

Please sign in to comment.