Skip to content

Commit 3ca72e5

Browse files
authored
dotnet test options compatibility (#85)
* dotnet test options compatibility * Remove Akka.MultiNode.TestRunner * Update build script * Remove NET Framework support, add .NET 5.0 support * Update build script for .NET 5.0 * Update build script * Fix build script
1 parent f432727 commit 3ca72e5

40 files changed

+447
-524
lines changed

Akka.MultiNodeTestRunner.sln

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 16
44
VisualStudioVersion = 16.0.29230.47
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Akka.MultiNode.TestRunner", "src\Akka.MultiNode.TestRunner\Akka.MultiNode.TestRunner.csproj", "{E945AABA-2779-41E8-9B43-8898FFD64F22}"
7-
EndProject
86
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{79D71264-186B-4F62-8930-35DD9ECCAF3B}"
97
ProjectSection(SolutionItems) = preProject
108
build.cmd = build.cmd
@@ -33,10 +31,6 @@ Global
3331
Release|Any CPU = Release|Any CPU
3432
EndGlobalSection
3533
GlobalSection(ProjectConfigurationPlatforms) = postSolution
36-
{E945AABA-2779-41E8-9B43-8898FFD64F22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37-
{E945AABA-2779-41E8-9B43-8898FFD64F22}.Debug|Any CPU.Build.0 = Debug|Any CPU
38-
{E945AABA-2779-41E8-9B43-8898FFD64F22}.Release|Any CPU.ActiveCfg = Release|Any CPU
39-
{E945AABA-2779-41E8-9B43-8898FFD64F22}.Release|Any CPU.Build.0 = Release|Any CPU
4034
{2F249AFE-6F7E-42CA-9D84-A3914F9DD158}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
4135
{2F249AFE-6F7E-42CA-9D84-A3914F9DD158}.Debug|Any CPU.Build.0 = Debug|Any CPU
4236
{2F249AFE-6F7E-42CA-9D84-A3914F9DD158}.Release|Any CPU.ActiveCfg = Release|Any CPU

RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
#### 0.1.14 October 05 2019 ####
2+
Temp local nuget
3+
14
#### 0.1.13 October 05 2019 ####
25
First release

build-system/azure-pipeline.template.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ jobs:
1313
pool:
1414
vmImage: ${{ parameters.vmImage }}
1515
steps:
16+
- task: UseDotNet@2
17+
displayName: 'Use .NET 5 SDK 5.0.101'
18+
inputs:
19+
version: 5.0.101
20+
- task: UseDotNet@2
21+
displayName: 'Use .NET Core Runtime 3.1.10'
22+
inputs:
23+
packageType: runtime
24+
version: 3.1.10
1625
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
1726
clean: false # whether to fetch clean each time
1827
submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules

build-system/pr-validation.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
parameters:
1919
name: 'windows_pr'
2020
displayName: 'Windows PR Validation'
21-
vmImage: 'vs2017-win2016'
21+
vmImage: 'windows-2019'
2222
scriptFileName: build.cmd
2323
scriptArgs: all
2424
outputDirectory: 'bin/nuget'
@@ -27,7 +27,7 @@ jobs:
2727
parameters:
2828
name: 'linux_pr'
2929
displayName: 'Linux PR Validation'
30-
vmImage: 'ubuntu-16.04'
30+
vmImage: 'ubuntu-20.04'
3131
scriptFileName: ./build.sh
3232
scriptArgs: all
3333
outputDirectory: 'bin/nuget'

build-system/windows-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for reference
33

44
pool:
5-
vmImage: vs2017-win2016
5+
vmImage: windows-2019
66
demands: Cmd
77

88
trigger:

build.fsx

Lines changed: 53 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ open Fake.DocFxHelper
1313
let configuration = "Release"
1414

1515
// Configuration values for tests
16-
let testNetFrameworkVersion = "net472"
1716
let testNetCoreVersion = "netcoreapp3.1"
17+
let testNetVersion = "net5.0"
1818

1919
// Metadata used when signing packages and DLLs
20-
let signingName = "My Library"
21-
let signingDescription = "My REALLY COOL Library"
20+
let signingName = "Akka.MultiNode.TestAdapter"
21+
let signingDescription = "Akka.NET Multi-node Test Adapter; used for executing tests written with Akka.Remote.TestKit"
2222
let signingUrl = "https://signing.is.cool/"
2323

2424
// Read release notes and version
@@ -58,19 +58,24 @@ Target "Clean" (fun _ ->
5858
CleanDir outputPerfTests
5959
CleanDir outputNuGet
6060
CleanDir "docs/_site"
61+
62+
CleanDirs !! "./**/bin"
63+
CleanDirs !! "./**/obj"
6164
)
6265

6366
Target "AssemblyInfo" (fun _ ->
6467
XmlPokeInnerText "./src/common.props" "//Project/PropertyGroup/VersionPrefix" releaseNotes.AssemblyVersion
6568
XmlPokeInnerText "./src/common.props" "//Project/PropertyGroup/PackageReleaseNotes" (releaseNotes.Notes |> String.concat "\n")
6669
)
6770

68-
Target "Build" (fun _ ->
71+
Target "Build" (fun _ ->
72+
let additionalArgs = if versionSuffix.Length > 0 then [sprintf "/p:VersionSuffix=%s" versionSuffix] else []
6973
DotNetCli.Build
7074
(fun p ->
7175
{ p with
7276
Project = solutionFile
73-
Configuration = configuration }) // "Rebuild"
77+
Configuration = configuration
78+
AdditionalArgs = additionalArgs }) // "Rebuild"
7479
)
7580

7681

@@ -96,25 +101,46 @@ module internal ResultHandling =
96101
>> Option.iter (failBuildWithMessage errorLevel)
97102

98103
Target "RunTests" (fun _ ->
99-
let projects =
100-
match (isWindows) with
101-
| true -> !! "./src/**/*.Tests.csproj"
102-
| _ -> !! "./src/**/*.Tests.csproj" // if you need to filter specs for Linux vs. Windows, do it here
104+
let projects = match (isWindows) with
105+
| true -> !! "./src/**/*.Tests.*sproj"
106+
| _ -> !! "./src/**/*.Tests.*sproj" // if you need to filter specs for Linux vs. Windows, do it here
103107

104108
let runSingleProject project =
105109
let arguments =
106-
match (isWindows) with
107-
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s" (outputTests))
108-
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s --framework %s" outputTests testNetCoreVersion)
110+
match (hasTeamCity) with
111+
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory \"%s\" -- -parallel none -teamcity" testNetCoreVersion outputTests)
112+
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory \"%s\" -- -parallel none" testNetCoreVersion outputTests)
109113

110114
let result = ExecProcess(fun info ->
111115
info.FileName <- "dotnet"
112116
info.WorkingDirectory <- (Directory.GetParent project).FullName
113-
info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0)
114-
115-
ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result
117+
info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0)
118+
119+
ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result
120+
121+
CreateDir outputTests
122+
projects |> Seq.iter (runSingleProject)
123+
)
124+
125+
Target "RunTestsNet" (fun _ ->
126+
let projects = match (isWindows) with
127+
| true -> !! "./src/**/*.Tests.*sproj"
128+
| _ -> !! "./src/**/*.Tests.*sproj" // if you need to filter specs for Linux vs. Windows, do it here
129+
130+
let runSingleProject project =
131+
let arguments =
132+
match (hasTeamCity) with
133+
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory \"%s\" -- -parallel none -teamcity" testNetVersion outputTests)
134+
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory \"%s\" -- -parallel none" testNetVersion outputTests)
135+
136+
let result = ExecProcess(fun info ->
137+
info.FileName <- "dotnet"
138+
info.WorkingDirectory <- (Directory.GetParent project).FullName
139+
info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0)
116140

117-
projects |> Seq.iter (log)
141+
ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result
142+
143+
CreateDir outputTests
118144
projects |> Seq.iter (runSingleProject)
119145
)
120146

@@ -201,8 +227,7 @@ Target "CreateNuget" (fun _ ->
201227
let projects = !! "src/**/*.csproj"
202228
-- "src/**/*Tests.csproj" // Don't publish unit tests
203229
-- "src/**/*Tests*.csproj"
204-
-- "src/**/*.MultiNode.TestRunner.csproj" // Do not publish MNTR nuget packages
205-
-- "src/**/*.MultiNode.TestAdapter.csproj"
230+
-- "src/**/*.MultiNode.TestAdapter.csproj" // Do not publish MNTR nuget packages
206231
-- "src/**/*.MultiNode.NodeRunner.csproj"
207232
-- "src/**/*.MultiNode.Shared.csproj"
208233
-- "src/**/*.MultiNode.TestRunner.Shared.csproj"
@@ -221,14 +246,15 @@ Target "CreateNuget" (fun _ ->
221246
)
222247

223248
Target "PublishMntr" (fun _ ->
224-
let executableProjects = !! "./src/**/Akka.MultiNode.TestRunner.csproj" ++ "./src/**/Akka.MultiNode.TestAdapter.csproj"
225-
249+
let executableProjects = !! "./src/**/Akka.MultiNode.TestAdapter.csproj"
250+
let additionalArgs = if versionSuffix.Length > 0 then [sprintf "/p:VersionSuffix=%s" versionSuffix] else []
251+
226252
executableProjects |> Seq.iter (fun project ->
227253
DotNetCli.Restore
228254
(fun p ->
229255
{ p with
230256
Project = project
231-
AdditionalArgs = [sprintf "/p:VersionSuffix=%s" versionSuffix] })
257+
AdditionalArgs = additionalArgs })
232258
)
233259

234260
executableProjects |> Seq.iter (fun project ->
@@ -237,17 +263,16 @@ Target "PublishMntr" (fun _ ->
237263
{ p with
238264
Project = project
239265
Configuration = configuration
240-
Framework = testNetFrameworkVersion
266+
Framework = testNetCoreVersion
241267
VersionSuffix = versionSuffix }))
242268

243-
// Windows .NET Core
244269
executableProjects |> Seq.iter (fun project ->
245270
DotNetCli.Publish
246271
(fun p ->
247272
{ p with
248273
Project = project
249274
Configuration = configuration
250-
Framework = testNetCoreVersion
275+
Framework = testNetVersion
251276
VersionSuffix = versionSuffix }))
252277
)
253278

@@ -264,13 +289,11 @@ Target "CreateMntrNuget" (fun _ ->
264289
nuspecPath
265290

266291
let nuspecTemplates = [
267-
"./src/Akka.MultiNode.TestRunner/Akka.MultiNode.TestRunner.nuspec.template";
268292
"./src/Akka.MultiNode.TestAdapter/Akka.MultiNode.TestAdapter.nuspec.template"
269293
]
270294
let nuspecFiles = List.map (generateNuspec) nuspecTemplates
271295

272-
let executableProjects = !! "./src/**/Akka.MultiNode.TestRunner.csproj"
273-
++ "./src/**/Akka.MultiNode.TestAdapter.csproj"
296+
let executableProjects = !! "./src/**/Akka.MultiNode.TestAdapter.csproj"
274297

275298
executableProjects |> Seq.iter (fun project ->
276299
DotNetCli.Pack
@@ -368,17 +391,19 @@ Target "Nuget" DoNothing
368391

369392
// tests dependencies
370393
"Build" ==> "RunTests"
394+
"Build" ==> "RunTestsNet"
371395

372396
// nuget dependencies
373397
"BuildRelease" ==> "CreateMntrNuget" ==> "CreateNuget"
374398
"CreateNuget" ==> "SignPackages" ==> "PublishNuget" ==> "Nuget"
375399

376400
// docs
377-
"Clean" ==> "BuildRelease" ==> "Docfx"
401+
"BuildRelease" ==> "Docfx"
378402

379403
// all
380404
"BuildRelease" ==> "All"
381405
"RunTests" ==> "All"
406+
"RunTestsNet" ==> "All"
382407
"NBench" ==> "All"
383408
"Nuget" ==> "All"
384409

build.ps1

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ Param(
3030
)
3131

3232
$FakeVersion = "4.61.2"
33-
$DotNetChannel = "LTS";
34-
$DotNetVersion = "3.1.100";
35-
$DotNetInstallerUri = "https://dot.net/v1/dotnet-install.ps1";
3633
$NugetVersion = "4.1.0";
3734
$NugetUrl = "https://dist.nuget.org/win-x86-commandline/v$NugetVersion/nuget.exe"
3835
$ProtobufVersion = "3.4.0"
@@ -46,50 +43,6 @@ if (!(Test-Path $ToolPath)) {
4643
New-Item -Path $ToolPath -Type directory | out-null
4744
}
4845

49-
###########################################################################
50-
# INSTALL .NET CORE CLI
51-
###########################################################################
52-
53-
Function Remove-PathVariable([string]$VariableToRemove)
54-
{
55-
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
56-
if ($path -ne $null)
57-
{
58-
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
59-
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User")
60-
}
61-
62-
$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
63-
if ($path -ne $null)
64-
{
65-
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
66-
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process")
67-
}
68-
}
69-
70-
# Get .NET Core CLI path if installed.
71-
$FoundDotNetCliVersion = $null;
72-
if (Get-Command dotnet -ErrorAction SilentlyContinue) {
73-
$FoundDotNetCliVersion = dotnet --version;
74-
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
75-
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
76-
}
77-
78-
if($FoundDotNetCliVersion -ne $DotNetVersion) {
79-
$InstallPath = Join-Path $PSScriptRoot ".dotnet"
80-
if (!(Test-Path $InstallPath)) {
81-
mkdir -Force $InstallPath | Out-Null;
82-
}
83-
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1");
84-
& $InstallPath\dotnet-install.ps1 -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath -Architecture x64;
85-
86-
Remove-PathVariable "$InstallPath"
87-
$env:PATH = "$InstallPath;$env:PATH"
88-
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
89-
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
90-
$env:DOTNET_ROOT=$InstallPath
91-
}
92-
9346
###########################################################################
9447
# INSTALL NUGET
9548
###########################################################################

build.sh

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,6 @@ if [ ! -d "$TOOLS_DIR" ]; then
4242
mkdir "$TOOLS_DIR"
4343
fi
4444

45-
###########################################################################
46-
# INSTALL .NET CORE CLI
47-
###########################################################################
48-
49-
echo "Installing .NET CLI..."
50-
if [ ! -d "$SCRIPT_DIR/.dotnet" ]; then
51-
mkdir "$SCRIPT_DIR/.dotnet"
52-
fi
53-
curl -Lsfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" $DOTNET_INSTALLER_URL
54-
bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version $DOTNET_VERSION --channel $DOTNET_CHANNEL --install-dir .dotnet --no-path
55-
export PATH="$SCRIPT_DIR/.dotnet":$PATH
56-
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
57-
export DOTNET_CLI_TELEMETRY_OPTOUT=1
58-
chmod -R 0755 ".dotnet"
59-
"$SCRIPT_DIR/.dotnet/dotnet" --info
60-
61-
6245
###########################################################################
6346
# INSTALL NUGET
6447
###########################################################################

src/Akka.MultiNode.NodeRunner/Akka.MultiNode.NodeRunner.csproj

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@
22
<Import Project="..\common.props" />
33

44
<PropertyGroup>
5-
<AssemblyTitle>Akka.MultiNode.NodeRunner</AssemblyTitle>
6-
<TargetFrameworks>$(NetFrameworkTestVersion);$(NetCoreTestVersion)</TargetFrameworks>
75
<OutputType>Exe</OutputType>
8-
<RootNamespace>Akka.MultiNode.NodeRunner</RootNamespace>
9-
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
6+
<TargetFrameworks>$(NetCoreTestVersion);$(NetTestVersion)</TargetFrameworks>
107
</PropertyGroup>
118

129
<ItemGroup>
1310
<PackageReference Include="xunit.runner.utility" Version="$(XunitVersion)" />
1411
<PackageReference Include="Akka.Remote.TestKit" Version="$(AkkaVersion)" />
1512
<PackageReference Include="Akka.TestKit.Xunit2" Version="$(AkkaVersion)" />
16-
</ItemGroup>
17-
18-
<ItemGroup Condition="'$(TargetFramework)' == '$(NetCoreTestVersion)'">
1913
<PackageReference Include="System.Runtime.Loader" Version="$(SystemRuntimeLoaderVersion)" />
2014
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(DependencyModelVersion)" />
2115
</ItemGroup>
@@ -24,10 +18,6 @@
2418
<ProjectReference Include="..\Akka.MultiNode.Shared\Akka.MultiNode.Shared.csproj" />
2519
</ItemGroup>
2620

27-
<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetCoreTestVersion)' ">
28-
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
29-
</PropertyGroup>
30-
3121
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
3222
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
3323
</PropertyGroup>

src/Akka.MultiNode.NodeRunner/Discovery.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515
namespace Akka.MultiNode.NodeRunner
1616
{
1717
[Serializable]
18-
#if CORECLR
1918
public class Discovery : IMessageSink, IDisposable
20-
#else
21-
public class Discovery : MarshalByRefObject, IMessageSink, IDisposable
22-
#endif
2319
{
2420
private readonly string _assemblyName;
2521
private readonly string _className;

0 commit comments

Comments
 (0)