Skip to content

Commit

Permalink
NuGet packaging for MNTR (Windows/.NET 4.5.2) (#2935)
Browse files Browse the repository at this point in the history
* preliminary createmntrnuget step

* make createmntrnuget as dep for createnuget

* added netcoreapp1.1 publishing

* removed manual copy of dotnet executables replaced with dotnet publish output

* remove multi
  • Loading branch information
heynickc authored and Arkatufus committed Aug 9, 2017
1 parent 020ae2d commit 500cd3a
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 99 deletions.
157 changes: 78 additions & 79 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ let versionSuffix =
match (getBuildParam "nugetprerelease") with
| "dev" -> "beta" + (if (not (buildNumber = "0")) then ("-" + buildNumber) else "")
| _ -> ""
let releaseNotes =
File.ReadLines "./RELEASE_NOTES.md"
|> ReleaseNotesHelper.parseReleaseNotes

Target "Clean" (fun _ ->
ActivateFinalTarget "KillCreatedProcesses"
Expand All @@ -51,9 +54,6 @@ Target "Clean" (fun _ ->
)

Target "AssemblyInfo" (fun _ ->
let releaseNotes =
File.ReadLines "./RELEASE_NOTES.md"
|> ReleaseNotesHelper.parseReleaseNotes
XmlPokeInnerText "./src/common.props" "//Project/PropertyGroup/VersionPrefix" releaseNotes.AssemblyVersion
XmlPokeInnerText "./src/common.props" "//Project/PropertyGroup/PackageReleaseNotes" (releaseNotes.Notes |> String.concat "\n")
)
Expand All @@ -78,17 +78,6 @@ Target "Build" (fun _ ->
Project = solution
Configuration = configuration
AdditionalArgs = additionalArgs })

let sourceBasePath = __SOURCE_DIRECTORY__ @@ "src" @@ "core"
let ntrBasePath = sourceBasePath @@ "Akka.NodeTestRunner" @@ "bin" @@ "Release"
let ntrNetPath = ntrBasePath @@ "net452"
let ntrNetCorePath = ntrBasePath @@ "netcoreapp1.1"
let mntrPath = sourceBasePath @@ "Akka.MultiNodeTestRunner" @@ "bin" @@ "Release" @@ "netcoreapp1.1"
let copyNtrNetToMntrTargetPath = mntrPath @@ "runner" @@ "net"
let copyNtrNetCoreToMntrTargetPath = mntrPath @@ "runner" @@ "netcore"

CopyDir (copyNtrNetToMntrTargetPath) (ntrNetPath) allFiles
CopyDir (copyNtrNetCoreToMntrTargetPath) (ntrNetCorePath) allFiles
)

//--------------------------------------------------------------------------------
Expand Down Expand Up @@ -174,50 +163,45 @@ Target "RunTestsNetCore" (fun _ ->
projects |> Seq.iter (runSingleProject)
)

Target "MultiNodeTestsNetCore" (fun _ ->
Target "MultiNodeTests" (fun _ ->
ActivateFinalTarget "KillCreatedProcesses"
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.dll" (currentDirectory @@ "src" @@ "core" @@ "Akka.MultiNodeTestRunner" @@ "bin" @@ "Release" @@ "netcoreapp1.1")
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.exe" (currentDirectory @@ "src" @@ "core" @@ "Akka.MultiNodeTestRunner" @@ "bin" @@ "Release" @@ "net452")

let multiNodeTestAssemblies =
match getBuildParamOrDefault "incremental" "" with
| "true" -> log "The following test projects would be run under Incremental Test config..."
getIncrementalNetCoreMNTRTests() |> Seq.map (fun x -> printfn "\t%s" x; x)
getIncrementalMNTRTests() |> Seq.map (fun x -> printfn "\t%s" x; x)
| "experimental" -> log "The following MNTR specs would be run under Incremental Test config..."
getIncrementalNetCoreMNTRTests() |> Seq.iter log
getAllMntrTestNetCoreAssemblies()
getIncrementalMNTRTests() |> Seq.iter log
getAllMntrTestAssemblies()
| _ -> log "All test projects will be run"
getAllMntrTestNetCoreAssemblies()
getAllMntrTestAssemblies()

printfn "Using MultiNodeTestRunner: %s" multiNodeTestPath

let runMultiNodeSpec assembly =
match assembly with
| null -> ()
| _ ->
let spec = getBuildParam "spec"
let spec = getBuildParam "spec"

let args = StringBuilder()
|> append multiNodeTestPath
|> append assembly
|> append "-Dmultinode.teamcity=true"
|> append "-Dmultinode.enable-filesink=on"
|> append (sprintf "-Dmultinode.output-directory=\"%s\"" outputMultiNode)
|> append "-Dmultinode.platform=netcore"
|> appendIfNotNullOrEmpty spec "-Dmultinode.spec="
|> toText
let args = StringBuilder()
|> append assembly
|> append "-Dmultinode.teamcity=true"
|> append "-Dmultinode.enable-filesink=on"
|> append (sprintf "-Dmultinode.output-directory=\"%s\"" outputMultiNode)
|> appendIfNotNullOrEmpty spec "-Dmultinode.spec="
|> toText

let result = ExecProcess(fun info ->
info.FileName <- "dotnet"
info.WorkingDirectory <- (Path.GetDirectoryName (FullName multiNodeTestPath))
info.Arguments <- args) (System.TimeSpan.FromMinutes 60.0) (* This is a VERY long running task. *)
if result <> 0 then failwithf "MultiNodeTestRunner failed. %s %s" multiNodeTestPath args
let result = ExecProcess(fun info ->
info.FileName <- multiNodeTestPath
info.WorkingDirectory <- (Path.GetDirectoryName (FullName multiNodeTestPath))
info.Arguments <- args) (System.TimeSpan.FromMinutes 60.0) (* This is a VERY long running task. *)
if result <> 0 then failwithf "MultiNodeTestRunner failed. %s %s" multiNodeTestPath args

multiNodeTestAssemblies |> Seq.iter (runMultiNodeSpec)
)

Target "MultiNodeTestsMultiPlatform" (fun _ ->
Target "MultiNodeTestsNetCore" (fun _ ->
ActivateFinalTarget "KillCreatedProcesses"
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.dll" (currentDirectory @@ "src" @@ "core" @@ "Akka.MultiNodeTestRunner" @@ "bin" @@ "Release" @@ "netcoreapp1.1")
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.dll" (currentDirectory @@ "src" @@ "core" @@ "Akka.MultiNodeTestRunner" @@ "bin" @@ "Release" @@ "netcoreapp1.1" @@ "win7-x64" @@ "publish")

let multiNodeTestAssemblies =
match getBuildParamOrDefault "incremental" "" with
Expand All @@ -243,7 +227,7 @@ Target "MultiNodeTestsMultiPlatform" (fun _ ->
|> append "-Dmultinode.teamcity=true"
|> append "-Dmultinode.enable-filesink=on"
|> append (sprintf "-Dmultinode.output-directory=\"%s\"" outputMultiNode)
|> append "-Dmultinode.platform=multi"
|> append "-Dmultinode.platform=netcore"
|> appendIfNotNullOrEmpty spec "-Dmultinode.spec="
|> toText

Expand All @@ -256,42 +240,6 @@ Target "MultiNodeTestsMultiPlatform" (fun _ ->
multiNodeTestAssemblies |> Seq.iter (runMultiNodeSpec)
)

Target "MultiNodeTests" (fun _ ->
ActivateFinalTarget "KillCreatedProcesses"
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.exe" (currentDirectory @@ "src" @@ "core" @@ "Akka.MultiNodeTestRunner" @@ "bin" @@ "Release" @@ "net452")

let multiNodeTestAssemblies =
match getBuildParamOrDefault "incremental" "" with
| "true" -> log "The following test projects would be run under Incremental Test config..."
getIncrementalMNTRTests() |> Seq.map (fun x -> printfn "\t%s" x; x)
| "experimental" -> log "The following MNTR specs would be run under Incremental Test config..."
getIncrementalMNTRTests() |> Seq.iter log
getAllMntrTestAssemblies()
| _ -> log "All test projects will be run"
getAllMntrTestAssemblies()

printfn "Using MultiNodeTestRunner: %s" multiNodeTestPath

let runMultiNodeSpec assembly =
let spec = getBuildParam "spec"

let args = StringBuilder()
|> append assembly
|> append "-Dmultinode.teamcity=true"
|> append "-Dmultinode.enable-filesink=on"
|> append (sprintf "-Dmultinode.output-directory=\"%s\"" outputMultiNode)
|> appendIfNotNullOrEmpty spec "-Dmultinode.spec="
|> toText

let result = ExecProcess(fun info ->
info.FileName <- multiNodeTestPath
info.WorkingDirectory <- (Path.GetDirectoryName (FullName multiNodeTestPath))
info.Arguments <- args) (System.TimeSpan.FromMinutes 60.0) (* This is a VERY long running task. *)
if result <> 0 then failwithf "MultiNodeTestRunner failed. %s %s" multiNodeTestPath args

multiNodeTestAssemblies |> Seq.iter (runMultiNodeSpec)
)

Target "NBench" <| fun _ ->
ActivateFinalTarget "KillCreatedProcesses"
CleanDir outputPerfTests
Expand Down Expand Up @@ -380,6 +328,57 @@ Target "CreateNuget" (fun _ ->
projects |> Seq.iter (runSingleProject)
)

Target "PublishMntr" (fun _ ->
let executableProjects = !! "./src/**/Akka.MultiNodeTestRunner.csproj"
let versionSuffixArg = sprintf "/p:VersionSuffix=%s" versionSuffix

// Windows .NET 4.5.2
executableProjects |> Seq.iter (fun project ->
DotNetCli.Restore
(fun p ->
{ p with
Project = project
AdditionalArgs = ["-r win7-x64"; versionSuffixArg] })
)

// Windows .NET 4.5.2
executableProjects |> Seq.iter (fun project ->
DotNetCli.Publish
(fun p ->
{ p with
Project = project
Configuration = configuration
Runtime = "win7-x64"
Framework = "net452"
VersionSuffix = versionSuffix }))

// Windows .NET Core
executableProjects |> Seq.iter (fun project ->
DotNetCli.Publish
(fun p ->
{ p with
Project = project
Configuration = configuration
Runtime = "win7-x64"
Framework = "netcoreapp1.1"
VersionSuffix = versionSuffix }))
)

Target "CreateMntrNuget" (fun _ ->
let executableProjects = !! "./src/**/Akka.MultiNodeTestRunner.csproj"

executableProjects |> Seq.iter (fun project ->
DotNetCli.Pack
(fun p ->
{ p with
Project = project
Configuration = configuration
AdditionalArgs = ["--include-symbols"]
VersionSuffix = versionSuffix
OutputPath = outputNuGet } )
)
)

Target "PublishNuget" (fun _ ->
let projects = !! "./bin/nuget/*.nupkg" -- "./bin/nuget/*.symbols.nupkg"
let apiKey = getBuildParamOrDefault "nugetkey" ""
Expand Down Expand Up @@ -519,14 +518,14 @@ Target "All" DoNothing
Target "Nuget" DoNothing

// build dependencies
"Clean" ==> "RestorePackages" ==> "Build" ==> "BuildRelease"
"Clean" ==> "RestorePackages" ==> "Build" ==> "PublishMntr" ==> "BuildRelease"

// tests dependencies
// "RunTests" step doesn't require Clean ==> "RestorePackages" step
"Clean" ==> "RestorePackages" ==> "RunTestsNetCore"

// nuget dependencies
"Clean" ==> "RestorePackages" ==> "Build" ==> "CreateNuget"
"Clean" ==> "RestorePackages" ==> "Build" ==> "PublishMntr" ==> "CreateMntrNuget" ==> "CreateNuget"
"CreateNuget" ==> "PublishNuget" ==> "Nuget"

// docs
Expand Down
2 changes: 1 addition & 1 deletion src/Akka.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.14
VisualStudioVersion = 15.0.26430.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Benchmark", "Benchmark", "{73108242-625A-4D7B-AA09-63375DBAE464}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
<Description>Akka.NET Multi-node Test Runner; used for executing tests written with Akka.Remote.TestKit</Description>
<TargetFrameworks>net452;netcoreapp1.1</TargetFrameworks>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>
<PackageTags>$(AkkaPackageTags)</PackageTags>
<NuspecFile>Akka.MultiNodeTestRunner.nuspec</NuspecFile>
</PropertyGroup>

<ItemGroup>
Expand Down
21 changes: 21 additions & 0 deletions src/core/Akka.MultiNodeTestRunner/Akka.MultiNodeTestRunner.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Akka.MultiNodeTestRunner</id>
<version>1.3.0-beta</version>
<title>Akka.MultiNodeTestRunner</title>
<authors>Akka.NET Team</authors>
<owners>Akka.NET Team</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<licenseUrl>https://github.com/akkadotnet/akka.net/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/akkadotnet/akka.net</projectUrl>
<iconUrl>http://getakka.net/images/AkkaNetLogo.Normal.png</iconUrl>
<description>Akka.NET Multi-node Test Runner; used for executing tests written with Akka.Remote.TestKit</description>
<copyright>Copyright � 2013-2017 Akka.NET Team</copyright>
<tags>akka actors actor model Akka concurrency</tags>
</metadata>
<files>
<file src="bin\Release\net452\win7-x64\publish\*.*" target="lib\net452\" />
<file src="bin\Release\netcoreapp1.1\win7-x64\publish\*.*" target="lib\netcoreapp1.1\" />
</files>
</package>
23 changes: 4 additions & 19 deletions src/core/Akka.MultiNodeTestRunner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ class Program
private static HashSet<string> _validNetCorePlatform = new HashSet<string>
{
"net",
"netcore",
"multi"
"netcore"
};

protected static ActorSystem TestRunSystem;
Expand Down Expand Up @@ -137,7 +136,7 @@ static void Main(string[] args)
#if CORECLR
if (!_validNetCorePlatform.Contains(platform))
{
throw new Exception($"Target platform not supported: {platform}. Supported platforms are net, netcore and multi");
throw new Exception($"Target platform not supported: {platform}. Supported platforms are net and netcore");
}
#else
if (platform != "net")
Expand Down Expand Up @@ -213,8 +212,8 @@ static void Main(string[] args)

StartNewSpec(test.Value);
#if CORECLR
var ntrNetPath = Path.Combine(AppContext.BaseDirectory, "runner", "net", "Akka.NodeTestRunner.exe");
var ntrNetCorePath = Path.Combine(AppContext.BaseDirectory, "runner", "netcore", "Akka.NodeTestRunner.dll");
var ntrNetPath = Path.Combine(AppContext.BaseDirectory, "Akka.NodeTestRunner.exe");
var ntrNetCorePath = Path.Combine(AppContext.BaseDirectory, "Akka.NodeTestRunner.dll");
var alternateIndex = 0;
#endif
foreach (var nodeTest in test.Value)
Expand Down Expand Up @@ -245,20 +244,6 @@ static void Main(string[] args)
sbArguments.Insert(0, $@" -Dmultinode.test-assembly=""{assemblyPath}"" ");
sbArguments.Insert(0, ntrNetCorePath);
break;
case "multi":
if (alternateIndex % 2 == 0)
{
fileName = ntrNetPath;
sbArguments.Insert(0, $@" -Dmultinode.test-assembly=""{ChangeDllPathPlatform(assemblyPath, "net452")}"" ");
}
else
{
fileName = "dotnet";
sbArguments.Insert(0, $@" -Dmultinode.test-assembly=""{ChangeDllPathPlatform(assemblyPath, "netcoreapp1.1")}"" ");
sbArguments.Insert(0, ntrNetCorePath);
}
++alternateIndex;
break;
}
var process = new Process
{
Expand Down

0 comments on commit 500cd3a

Please sign in to comment.