From c63070a41c3e731666e2fdda6e565d2e4137d1b7 Mon Sep 17 00:00:00 2001 From: Nick Chamberlain Date: Mon, 5 Jun 2017 21:35:57 -0400 Subject: [PATCH 01/11] revise createnuget step in fake --- build.fsx | 317 ++++++++++-------- .../NBench.Runner.DotNetCli.csproj | 1 + .../NBench.Runner.DotNetCli.nuspec | 25 ++ src/SharedAssemblyInfo.cs | 4 +- 4 files changed, 203 insertions(+), 144 deletions(-) create mode 100644 src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.nuspec diff --git a/build.fsx b/build.fsx index 72494026..a7260683 100644 --- a/build.fsx +++ b/build.fsx @@ -80,9 +80,19 @@ Target "Build" (fun _ -> Configuration = configuration AdditionalArgs = ["--no-incremental"]}) // "Rebuild" - let projects = !! "./src/**/*.csproj" ++ "./tests/**/*.csproj" + let projects = !! "./src/**/*.csproj" + ++ "./tests/**/*.csproj" + -- "./src/**/NBench.Runner.DotNetCli.csproj" projects |> Seq.iter (runSingleProject) + + DotNetCli.Build + (fun p -> + { p with + Project = Seq.head (!! "./src/**/NBench.Runner.DotNetCli.csproj") + Configuration = configuration + Runtime = "win7-x64" + AdditionalArgs = ["--no-incremental"]}) ) Target "RunTests" (fun _ -> @@ -245,153 +255,179 @@ Target "CopyOutput" (fun _ -> netCoreProjects |> List.iter (fun p -> publishSingleProjectNetCoreApp p) ) -Target "CreateNuget" (fun _ -> - let nugetProjects = [ "./src/NBench/NBench.csproj"; - "./src/NBench.PerformanceCounters/NBench.PerformanceCounters.csproj"; - "./src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.csproj" ] +//-------------------------------------------------------------------------------- +// Nuget targets +//-------------------------------------------------------------------------------- +module Nuget = + // add NBench dependency for other projects + let getNBenchDependencies project = + match project with + | "NBench.PerformanceCounters" -> ["NBench", release.NugetVersion] + | _ -> [] - nugetProjects |> List.iter (fun proj -> - DotNetCli.Pack - (fun p -> - { p with - Project = proj - Configuration = configuration - AdditionalArgs = ["--include-symbols"] - OutputPath = outputNuGet }) - ) + // used to add -pre suffix to pre-release packages + let getProjectVersion project = + match project with + | _ -> release.NugetVersion - // NBench.Runner.exe NuGet Create +open Nuget - // Only using this to build NBench.Runner which doesn't need this result - let getDependencies project = [] +//-------------------------------------------------------------------------------- +// Clean nuget directory +Target "CleanNuget" (fun _ -> + CleanDir nugetDir +) - // used to add -pre suffix to pre-release packages - let getProjectVersion project = +//-------------------------------------------------------------------------------- +// Pack nuget for all projects +// Publish to nuget.org if nugetkey is specified + +let createNugetPackages _ = + let mutable dirName = 1 + let removeDir dir = + let del _ = + DeleteDir dir + not (directoryExists dir) + runWithRetries del 3 |> ignore + + let getDirName workingDir dirCount = + workingDir + dirCount.ToString() + + let getReleaseFiles project releaseDir = match project with - | _ -> release.NugetVersion - - let createNugetPackages _ = - let mutable dirName = 1 - let removeDir dir = - let del _ = - DeleteDir dir - not (directoryExists dir) - runWithRetries del 3 |> ignore - - let getDirName workingDir dirCount = - workingDir + dirCount.ToString() - - let getReleaseFiles project releaseDir = - match project with - | "NBench.Runner" -> - !! (releaseDir @@ "*.dll") - ++ (releaseDir @@ "*.exe") - ++ (releaseDir @@ "*.pdb") - ++ (releaseDir @@ "*.xml") - | _ -> - !! (releaseDir @@ ".dll") - ++ (releaseDir @@ ".exe") - ++ (releaseDir @@ ".pdb") - ++ (releaseDir @@ ".xml") - - CleanDir workingDir - - ensureDirectory nugetDir - for nuspec in !! "src/**/*NBench.Runner.nuspec" do - printfn "Creating nuget packages for %s" nuspec + | "NBench.Runner" -> + !! (releaseDir @@ project + ".dll") + ++ (releaseDir @@ "NBench.dll") + ++ (releaseDir @@ project + ".exe") + ++ (releaseDir @@ project + ".pdb") + ++ (releaseDir @@ "NBench.pdb") + ++ (releaseDir @@ project + ".xml") + | "NBench.Runner.DotNetCli" -> + !! (releaseDir @@ "*") + | _ -> + !! (releaseDir @@ project + ".dll") + ++ (releaseDir @@ project + ".exe") + ++ (releaseDir @@ project + ".pdb") + ++ (releaseDir @@ project + ".xml") + + CleanDir workingDir + + let releaseDirLookup nuspecFile = + match Path.GetFileName nuspecFile with + | "NBench.Runner.nuspec" -> @"bin\Release\net452\win7-x64" + | "NBench.Runner.DotNetCli.nuspec" -> @"bin\Release\netcoreapp1.1\win7-x64" + | _ -> @"bin\Release\" + + ensureDirectory nugetDir + for nuspec in !! "src/**/*.nuspec" do + printfn "Creating nuget packages for %s" nuspec - let project = Path.GetFileNameWithoutExtension nuspec - let projectDir = Path.GetDirectoryName nuspec - let projectFile = (!! (projectDir @@ project + ".*sproj")) |> Seq.head - let releaseDir = projectDir @@ @"bin\Release\net452\win7-x64" - let packages = projectDir @@ "packages.config" - let packageDependencies = if (fileExists packages) then (getDependencies packages) else [] - let dependencies = packageDependencies @ getDependencies project - let releaseVersion = getProjectVersion project - - let pack outputDir symbolPackage = - NuGetHelper.NuGet - (fun p -> - { p with - Description = description - Authors = authors - Copyright = copyright - Project = project - Properties = ["Configuration", "Release"] - ReleaseNotes = release.Notes |> String.concat "\n" - Version = releaseVersion - Tags = tags |> String.concat " " - OutputPath = outputDir - WorkingDir = workingDir - SymbolPackage = symbolPackage - Dependencies = dependencies }) - nuspec - - // Copy dll, pdb and xml to libdir = workingDir/lib/net45/ - let libDir = workingDir @@ @"lib\net45" - printfn "Creating output directory %s" libDir - ensureDirectory libDir - CleanDir libDir - getReleaseFiles project releaseDir - |> CopyFiles libDir - - // Copy all src-files (.cs and .fs files) to workingDir/src - let nugetSrcDir = workingDir @@ @"src/" - CleanDir nugetSrcDir - - let isCs = hasExt ".cs" - let isFs = hasExt ".fs" - let isAssemblyInfo f = (filename f).Contains("AssemblyInfo") - let isSrc f = (isCs f || isFs f) && not (isAssemblyInfo f) - CopyDir nugetSrcDir projectDir isSrc + let project = Path.GetFileNameWithoutExtension nuspec + let projectDir = Path.GetDirectoryName nuspec + let projectFile = (!! (projectDir @@ project + ".*sproj")) |> Seq.head + let releaseDir = projectDir @@ (releaseDirLookup nuspec) + let packages = projectDir @@ "packages.config" + let packageDependencies = if (fileExists packages) then (getNBenchDependencies packages) else [] + let dependencies = packageDependencies @ getNBenchDependencies project + let releaseVersion = getProjectVersion project + + let pack outputDir symbolPackage = + NuGetHelper.NuGet + (fun p -> + { p with + Description = description + Authors = authors + Copyright = copyright + Project = project + Properties = ["Configuration", "Release"] + ReleaseNotes = release.Notes |> String.concat "\n" + Version = releaseVersion + Tags = tags |> String.concat " " + OutputPath = outputDir + WorkingDir = workingDir + SymbolPackage = symbolPackage + Dependencies = dependencies }) + nuspec + + // Copy dll, pdb and xml to libdir = workingDir/lib/net45/ + let libDir = workingDir @@ @"lib\net45" + printfn "Creating output directory %s" libDir + ensureDirectory libDir + CleanDir libDir + getReleaseFiles project releaseDir + |> CopyFiles libDir // TODO: this is where to glob all releases together + + // Copy all src-files (.cs and .fs files) to workingDir/src + let nugetSrcDir = workingDir @@ @"src/" + CleanDir nugetSrcDir + + let isCs = hasExt ".cs" + let isFs = hasExt ".fs" + let isAssemblyInfo f = (filename f).Contains("AssemblyInfo") + let isSrc f = (isCs f || isFs f) && not (isAssemblyInfo f) + CopyDir nugetSrcDir projectDir isSrc - //Remove workingDir/src/obj and workingDir/src/bin - removeDir (nugetSrcDir @@ "obj") - removeDir (nugetSrcDir @@ "bin") - - // Create both normal nuget package and symbols nuget package. - // Uses the files we copied to workingDir and outputs to nugetdir - pack nugetDir NugetSymbolPackage.Nuspec - + //Remove workingDir/src/obj and workingDir/src/bin + removeDir (nugetSrcDir @@ "obj") + removeDir (nugetSrcDir @@ "bin") + + // Create both normal nuget package and symbols nuget package. + // Uses the files we copied to workingDir and outputs to nugetdir + pack nugetDir NugetSymbolPackage.Nuspec + + +let publishNugetPackages _ = + let rec publishPackage url accessKey trialsLeft packageFile = + let tracing = enableProcessTracing + enableProcessTracing <- false + let args p = + match p with + | (pack, key, "") -> sprintf "push \"%s\" %s" pack key + | (pack, key, url) -> sprintf "push \"%s\" %s -source %s" pack key url + + tracefn "Pushing %s Attempts left: %d" (FullName packageFile) trialsLeft + try + let result = ExecProcess (fun info -> + info.FileName <- nugetExe + info.WorkingDirectory <- (Path.GetDirectoryName (FullName packageFile)) + info.Arguments <- args (packageFile, accessKey,url)) (System.TimeSpan.FromMinutes 1.0) + enableProcessTracing <- tracing + if result <> 0 then failwithf "Error during NuGet symbol push. %s %s" nugetExe (args (packageFile, "key omitted",url)) + with exn -> + if (trialsLeft > 0) then (publishPackage url accessKey (trialsLeft-1) packageFile) + else raise exn + let shouldPushNugetPackages = hasBuildParam "nugetkey" + let shouldPushSymbolsPackages = (hasBuildParam "symbolspublishurl") && (hasBuildParam "symbolskey") + + if (shouldPushNugetPackages || shouldPushSymbolsPackages) then + printfn "Pushing nuget packages" + if shouldPushNugetPackages then + let normalPackages= + !! (nugetDir @@ "*.nupkg") + -- (nugetDir @@ "*.symbols.nupkg") |> Seq.sortBy(fun x -> x.ToLower()) + for package in normalPackages do + try + publishPackage (getBuildParamOrDefault "nugetpublishurl" "") (getBuildParam "nugetkey") 3 package + with exn -> + printfn "%s" exn.Message + + if shouldPushSymbolsPackages then + let symbolPackages= !! (nugetDir @@ "*.symbols.nupkg") |> Seq.sortBy(fun x -> x.ToLower()) + for package in symbolPackages do + try + publishPackage (getBuildParam "symbolspublishurl") (getBuildParam "symbolskey") 3 package + with exn -> + printfn "%s" exn.Message + +Target "Nuget" <| fun _ -> createNugetPackages() -) + publishNugetPackages() -Target "PublishNuget" (fun _ -> - let projects = !! "./bin/nuget/*.nupkg" -- "./bin/nuget/*.symbols.nupkg" - let symbols = !! "./bin/nuget/*.symbols.nupkg" - - let apiKey = getBuildParamOrDefault "nugetkey" "" - let source = getBuildParamOrDefault "nugetpublishurl" "" +Target "CreateNuget" <| fun _ -> + createNugetPackages() - let shouldPushSymbolsPackages = (hasBuildParam "symbolspublishurl") && (hasBuildParam "symbolskey") - let symbolSource = getBuildParamOrDefault "symbolspublishurl" "" - let symbolsApiKey = getBuildParamOrDefault "symbolskey" "" - - if (shouldPushSymbolsPackages) then - let runSingleProject project = - try - DotNetCli.RunCommand - (fun p -> - { p with - TimeOut = TimeSpan.FromMinutes 10. }) - (sprintf "nuget push %s --source %s --api-key %s --symbol-source %s --symbol-api-key %s" project source apiKey symbolSource symbolsApiKey) - with exn -> - logfn "%s" exn.Message - - symbols |> Seq.iter (runSingleProject) - else - let runSingleProject project = - try - DotNetCli.RunCommand - (fun p -> - { p with - TimeOut = TimeSpan.FromMinutes 10. }) - (sprintf "nuget push %s --api-key %s --source %s" project apiKey source) - with exn -> - logfn "%s" exn.Message - - projects |> Seq.iter (runSingleProject) -) +Target "PublishNuget" <| fun _ -> + publishNugetPackages() //-------------------------------------------------------------------------------- // Help @@ -417,7 +453,6 @@ Target "Help" <| fun _ -> //-------------------------------------------------------------------------------- Target "BuildRelease" DoNothing -Target "Nuget" DoNothing Target "All" DoNothing Target "AllTests" DoNothing @@ -431,9 +466,7 @@ Target "AllTests" DoNothing "Clean" ==> "RestorePackages" ==> "Build" ==> "NBench" // nuget dependencies -"Clean" ==> "RestorePackages" ==> "Build" ==> "CreateNuget" -"CreateNuget" ==> "PublishNuget" -"CreateNuget" ==> "PublishNuget" ==> "Nuget" +"CleanNuget" ==> "BuildRelease" ==> "Nuget" // all "BuildRelease" ==> "All" diff --git a/src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.csproj b/src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.csproj index b29aeec6..f246e182 100644 --- a/src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.csproj +++ b/src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.csproj @@ -30,6 +30,7 @@ + \ No newline at end of file diff --git a/src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.nuspec b/src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.nuspec new file mode 100644 index 00000000..0194fd8a --- /dev/null +++ b/src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.nuspec @@ -0,0 +1,25 @@ + + + + @project@ + @project@@title@ + @build.number@ + @authors@ + @authors@ + NBench is a cross-platform automated performance profiling and testing framework for.NET applications. + https://github.com/petabridge/NBench/blob/master/LICENSE + https://github.com/petabridge/NBench + https://petabridge.com/images/nbench/NBench_logo_square_90.png + false + @releaseNotes@ + @copyright@ + @tags@ + @dependencies@ + @references@ + + + + + + + \ No newline at end of file diff --git a/src/SharedAssemblyInfo.cs b/src/SharedAssemblyInfo.cs index 670802d4..18f29a89 100644 --- a/src/SharedAssemblyInfo.cs +++ b/src/SharedAssemblyInfo.cs @@ -3,5 +3,5 @@ [assembly: AssemblyCompanyAttribute("Petabridge")] [assembly: AssemblyCopyrightAttribute("Copyright � 2015-2016")] -[assembly: AssemblyVersionAttribute("1.0.1")] -[assembly: AssemblyFileVersionAttribute("1.0.1")] +[assembly: AssemblyVersionAttribute("1.0.2")] +[assembly: AssemblyFileVersionAttribute("1.0.2")] From 0badfe0146e128f7a37a953da624cf105b0aa2c8 Mon Sep 17 00:00:00 2001 From: Nick Chamberlain Date: Tue, 6 Jun 2017 09:04:18 -0400 Subject: [PATCH 02/11] deprecate DotNetCli project and compile into NBench.Runner for .NET Core version --- build.fsx | 75 ++++++++++++------- .../NBench.Runner.DotNetCli.csproj | 1 - src/NBench.Runner/NBench.Runner.csproj | 8 +- 3 files changed, 55 insertions(+), 29 deletions(-) diff --git a/build.fsx b/build.fsx index a7260683..5f53ef03 100644 --- a/build.fsx +++ b/build.fsx @@ -80,19 +80,42 @@ Target "Build" (fun _ -> Configuration = configuration AdditionalArgs = ["--no-incremental"]}) // "Rebuild" - let projects = !! "./src/**/*.csproj" - ++ "./tests/**/*.csproj" - -- "./src/**/NBench.Runner.DotNetCli.csproj" + let assemblies = !! "./src/**/*.csproj" + ++ "./tests/**/*.csproj" + -- "./src/**/NBench.Runner.DotNetCli.csproj" // no longer building this proj + -- "./src/**/NBench.Runner.csproj" - projects |> Seq.iter (runSingleProject) + assemblies |> Seq.iter (runSingleProject) - DotNetCli.Build - (fun p -> - { p with - Project = Seq.head (!! "./src/**/NBench.Runner.DotNetCli.csproj") - Configuration = configuration - Runtime = "win7-x64" - AdditionalArgs = ["--no-incremental"]}) + let runners = !! "./src/**/NBench.Runner.csproj" + + // build win7-x64 target + runners |> Seq.iter (fun x -> + DotNetCli.Build + (fun p -> + { p with + Project = x + Configuration = configuration + AdditionalArgs = ["--no-incremental"]})) + + // make sure we build a debian.8-x64 runtime as well + // must restore for debian before building for debian + runners |> Seq.iter (fun x -> + DotNetCli.Restore + (fun p -> + { p with + Project = x + AdditionalArgs = ["-r debian.8-x64"] })) + + // build for debian + runners |> Seq.iter (fun x -> + DotNetCli.Build + (fun p -> + { p with + Project = x + Configuration = configuration + Runtime = "debian.8-x64" + AdditionalArgs = ["--no-incremental"]})) ) Target "RunTests" (fun _ -> @@ -155,21 +178,21 @@ Target "NBench" <| fun _ -> info.Arguments <- args) (System.TimeSpan.FromMinutes 15.0) (* Reasonably long-running task. *) if result <> 0 then failwithf "NBench.Runner failed. %s %s" nbenchRunner args - // .NET Core - let netCoreNbenchRunnerProject = "./src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.csproj" - DotNetCli.Restore - (fun p -> - { p with - Project = netCoreNbenchRunnerProject - AdditionalArgs = ["-r win7-x64"] }) - // build a win7-x64 version of dotnet-nbench.dll so we know we're testing the same architecture - DotNetCli.Build - (fun p -> - { p with - Project = netCoreNbenchRunnerProject - Configuration = configuration - Runtime = "win7-x64" - Framework = "netcoreapp1.1"}) + //// .NET Core + //let netCoreNbenchRunnerProject = "./src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.csproj" + //DotNetCli.Restore + // (fun p -> + // { p with + // Project = netCoreNbenchRunnerProject + // AdditionalArgs = ["-r win7-x64"] }) + //// build a win7-x64 version of dotnet-nbench.dll so we know we're testing the same architecture + //DotNetCli.Build + // (fun p -> + // { p with + // Project = netCoreNbenchRunnerProject + // Configuration = configuration + // Runtime = "win7-x64" + // Framework = "netcoreapp1.1"}) let netCoreNbenchRunner = findToolInSubPath "dotnet-nbench.exe" "/src/NBench.Runner.DotNetCli/bin/Release/netcoreapp1.1/win7-x64/" let netCoreAssembly = __SOURCE_DIRECTORY__ @@ "/tests/NBench.Tests.Performance.WithDependencies/bin/Release/netstandard1.6/NBench.Tests.Performance.WithDependencies.dll" diff --git a/src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.csproj b/src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.csproj index f246e182..b29aeec6 100644 --- a/src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.csproj +++ b/src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.csproj @@ -30,7 +30,6 @@ - \ No newline at end of file diff --git a/src/NBench.Runner/NBench.Runner.csproj b/src/NBench.Runner/NBench.Runner.csproj index a6b10829..4a3607e3 100644 --- a/src/NBench.Runner/NBench.Runner.csproj +++ b/src/NBench.Runner/NBench.Runner.csproj @@ -7,7 +7,7 @@ NBench.Runner 1.0.2 Petabridge - net452 + net452;netcoreapp1.1 Exe win7-x64 NBench.Runner @@ -23,8 +23,12 @@ false + + + + - + From 4a043319b10d4f8511058a61953c2bfe3cb68a30 Mon Sep 17 00:00:00 2001 From: Nick Chamberlain Date: Tue, 6 Jun 2017 09:43:37 -0400 Subject: [PATCH 03/11] typo in nbench step --- build.fsx | 37 +++++++++++++------------- src/NBench.Runner/NBench.Runner.csproj | 4 +-- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/build.fsx b/build.fsx index 5f53ef03..eba124ae 100644 --- a/build.fsx +++ b/build.fsx @@ -115,6 +115,7 @@ Target "Build" (fun _ -> Project = x Configuration = configuration Runtime = "debian.8-x64" + Framework = "netcoreapp1.1" AdditionalArgs = ["--no-incremental"]})) ) @@ -178,23 +179,23 @@ Target "NBench" <| fun _ -> info.Arguments <- args) (System.TimeSpan.FromMinutes 15.0) (* Reasonably long-running task. *) if result <> 0 then failwithf "NBench.Runner failed. %s %s" nbenchRunner args - //// .NET Core - //let netCoreNbenchRunnerProject = "./src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.csproj" - //DotNetCli.Restore - // (fun p -> - // { p with - // Project = netCoreNbenchRunnerProject - // AdditionalArgs = ["-r win7-x64"] }) - //// build a win7-x64 version of dotnet-nbench.dll so we know we're testing the same architecture - //DotNetCli.Build - // (fun p -> - // { p with - // Project = netCoreNbenchRunnerProject - // Configuration = configuration - // Runtime = "win7-x64" - // Framework = "netcoreapp1.1"}) - - let netCoreNbenchRunner = findToolInSubPath "dotnet-nbench.exe" "/src/NBench.Runner.DotNetCli/bin/Release/netcoreapp1.1/win7-x64/" + // .NET Core + let netCoreNbenchRunnerProject = "./src/NBench.Runner/NBench.Runner.csproj" + DotNetCli.Restore + (fun p -> + { p with + Project = netCoreNbenchRunnerProject + AdditionalArgs = ["-r win7-x64"] }) + // build a win7-x64 version of dotnet-nbench.dll so we know we're testing the same architecture + DotNetCli.Build + (fun p -> + { p with + Project = netCoreNbenchRunnerProject + Configuration = configuration + Runtime = "win7-x64" + Framework = "netcoreapp1.1"}) + + let netCoreNbenchRunner = findToolInSubPath "NBench.Runner.exe" "/src/NBench.Runner/bin/Release/netcoreapp1.1/win7-x64/" let netCoreAssembly = __SOURCE_DIRECTORY__ @@ "/tests/NBench.Tests.Performance.WithDependencies/bin/Release/netstandard1.6/NBench.Tests.Performance.WithDependencies.dll" let netCoreNbenchRunnerArgs = new StringBuilder() @@ -226,7 +227,7 @@ Target "NBench" <| fun _ -> Runtime = "debian.8-x64" Framework = "netcoreapp1.1"}) - let linuxNbenchRunner = __SOURCE_DIRECTORY__ @@ "/src/NBench.Runner.DotNetCli/bin/Release/netcoreapp1.1/debian.8-x64/dotnet-nbench" + let linuxNbenchRunner = __SOURCE_DIRECTORY__ @@ "/src/NBench.Runner.DotNetCli/bin/Release/netcoreapp1.1/debian.8-x64/NBench.Runner" let linuxPerfAssembly = __SOURCE_DIRECTORY__ @@ "/tests/NBench.Tests.Performance.WithDependencies/bin/Release/netstandard1.6/NBench.Tests.Performance.WithDependencies.dll" let linuxNbenchRunnerArgs = new StringBuilder() diff --git a/src/NBench.Runner/NBench.Runner.csproj b/src/NBench.Runner/NBench.Runner.csproj index 4a3607e3..b8854eb8 100644 --- a/src/NBench.Runner/NBench.Runner.csproj +++ b/src/NBench.Runner/NBench.Runner.csproj @@ -8,8 +8,8 @@ 1.0.2 Petabridge net452;netcoreapp1.1 - Exe - win7-x64 + Exe + win7-x64;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64 NBench.Runner performance;benchmarking;benchmark;perf;testing;NBench https://github.com/petabridge/NBench/raw/dev/images/NBench_logo_square_140.png From 2c16ebc6bef7c1739256e4ea158f04366a661c06 Mon Sep 17 00:00:00 2001 From: Nick Chamberlain Date: Tue, 6 Jun 2017 10:12:03 -0400 Subject: [PATCH 04/11] nuget tweaks --- build.fsx | 24 ++++++------------ .../NBench.Runner.DotNetCli.nuspec | 25 ------------------- 2 files changed, 8 insertions(+), 41 deletions(-) delete mode 100644 src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.nuspec diff --git a/build.fsx b/build.fsx index eba124ae..4fbab015 100644 --- a/build.fsx +++ b/build.fsx @@ -320,14 +320,12 @@ let createNugetPackages _ = let getReleaseFiles project releaseDir = match project with | "NBench.Runner" -> - !! (releaseDir @@ project + ".dll") - ++ (releaseDir @@ "NBench.dll") - ++ (releaseDir @@ project + ".exe") - ++ (releaseDir @@ project + ".pdb") - ++ (releaseDir @@ "NBench.pdb") - ++ (releaseDir @@ project + ".xml") - | "NBench.Runner.DotNetCli" -> - !! (releaseDir @@ "*") + !! (releaseDir @@ "net452" @@ project + ".dll") + ++ (releaseDir @@ "net452" @@ "NBench.dll") + ++ (releaseDir @@ "net452" @@ project + ".exe") + ++ (releaseDir @@ "net452" @@ project + ".pdb") + ++ (releaseDir @@ "net452" @@ "NBench.pdb") + ++ (releaseDir @@ "net452" @@ project + ".xml") | _ -> !! (releaseDir @@ project + ".dll") ++ (releaseDir @@ project + ".exe") @@ -336,12 +334,6 @@ let createNugetPackages _ = CleanDir workingDir - let releaseDirLookup nuspecFile = - match Path.GetFileName nuspecFile with - | "NBench.Runner.nuspec" -> @"bin\Release\net452\win7-x64" - | "NBench.Runner.DotNetCli.nuspec" -> @"bin\Release\netcoreapp1.1\win7-x64" - | _ -> @"bin\Release\" - ensureDirectory nugetDir for nuspec in !! "src/**/*.nuspec" do printfn "Creating nuget packages for %s" nuspec @@ -349,7 +341,7 @@ let createNugetPackages _ = let project = Path.GetFileNameWithoutExtension nuspec let projectDir = Path.GetDirectoryName nuspec let projectFile = (!! (projectDir @@ project + ".*sproj")) |> Seq.head - let releaseDir = projectDir @@ (releaseDirLookup nuspec) + let releaseDir = projectDir @@ @"bin\Release\" let packages = projectDir @@ "packages.config" let packageDependencies = if (fileExists packages) then (getNBenchDependencies packages) else [] let dependencies = packageDependencies @ getNBenchDependencies project @@ -374,7 +366,7 @@ let createNugetPackages _ = nuspec // Copy dll, pdb and xml to libdir = workingDir/lib/net45/ - let libDir = workingDir @@ @"lib\net45" + let libDir = workingDir @@ @"lib\" printfn "Creating output directory %s" libDir ensureDirectory libDir CleanDir libDir diff --git a/src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.nuspec b/src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.nuspec deleted file mode 100644 index 0194fd8a..00000000 --- a/src/NBench.Runner.DotNetCli/NBench.Runner.DotNetCli.nuspec +++ /dev/null @@ -1,25 +0,0 @@ - - - - @project@ - @project@@title@ - @build.number@ - @authors@ - @authors@ - NBench is a cross-platform automated performance profiling and testing framework for.NET applications. - https://github.com/petabridge/NBench/blob/master/LICENSE - https://github.com/petabridge/NBench - https://petabridge.com/images/nbench/NBench_logo_square_90.png - false - @releaseNotes@ - @copyright@ - @tags@ - @dependencies@ - @references@ - - - - - - - \ No newline at end of file From ab5829e2f0905a60dc3465ef59dc054c1523028e Mon Sep 17 00:00:00 2001 From: Nick Chamberlain Date: Tue, 6 Jun 2017 15:43:48 -0400 Subject: [PATCH 05/11] performancecounters re-enable --- build.fsx | 40 ++++++++++++++----- .../NBench.PerformanceCounters.nuspec | 24 +++++++++++ 2 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 src/NBench.PerformanceCounters/NBench.PerformanceCounters.nuspec diff --git a/build.fsx b/build.fsx index 4fbab015..8f6e30b0 100644 --- a/build.fsx +++ b/build.fsx @@ -89,6 +89,13 @@ Target "Build" (fun _ -> let runners = !! "./src/**/NBench.Runner.csproj" + runners |> Seq.iter (fun x -> + DotNetCli.Restore + (fun p -> + { p with + Project = x + AdditionalArgs = ["-r win7-x64"] })) + // build win7-x64 target runners |> Seq.iter (fun x -> DotNetCli.Build @@ -96,6 +103,7 @@ Target "Build" (fun _ -> { p with Project = x Configuration = configuration + Runtime = "win7-x64" AdditionalArgs = ["--no-incremental"]})) // make sure we build a debian.8-x64 runtime as well @@ -320,18 +328,28 @@ let createNugetPackages _ = let getReleaseFiles project releaseDir = match project with | "NBench.Runner" -> - !! (releaseDir @@ "net452" @@ project + ".dll") - ++ (releaseDir @@ "net452" @@ "NBench.dll") - ++ (releaseDir @@ "net452" @@ project + ".exe") - ++ (releaseDir @@ "net452" @@ project + ".pdb") - ++ (releaseDir @@ "net452" @@ "NBench.pdb") - ++ (releaseDir @@ "net452" @@ project + ".xml") + [| + (!! (releaseDir @@ "net452" @@ "win7-x64" @@ project + ".dll") + ++ (releaseDir @@ "net452" @@ "win7-x64" @@ "NBench.dll") + ++ (releaseDir @@ "net452" @@ "win7-x64" @@ project + ".exe") + ++ (releaseDir @@ "net452" @@ "win7-x64" @@ project + ".pdb") + ++ (releaseDir @@ "net452" @@ "win7-x64" @@ "NBench.pdb") + ++ (releaseDir @@ "net452" @@ "win7-x64" @@ project + ".xml"), "net452"); + (!! (releaseDir @@ "netcoreapp1.1" @@ "win7-x64" @@ "*"), "netcoreapp1.1" @@ "win7-x64"); + (!! (releaseDir @@ "netcoreapp1.1" @@ "debian.8-x64" @@ "*"), "netcoreapp1.1" @@ "debian.8-x64") + |] | _ -> - !! (releaseDir @@ project + ".dll") - ++ (releaseDir @@ project + ".exe") - ++ (releaseDir @@ project + ".pdb") - ++ (releaseDir @@ project + ".xml") + [| + (!! (releaseDir @@ "net452" @@ project + ".dll") + ++ (releaseDir @@ "net452" @@ project + ".exe") + ++ (releaseDir @@ "net452" @@ project + ".pdb") + ++ (releaseDir @@ "net452" @@ project + ".xml"), "net452") + |] + + let copyFilesToLibFolder libDir files = + files |> Seq.iter (fun (files, subFolder) -> CopyFiles (libDir @@ subFolder) files) + CleanDir workingDir ensureDirectory nugetDir @@ -371,7 +389,7 @@ let createNugetPackages _ = ensureDirectory libDir CleanDir libDir getReleaseFiles project releaseDir - |> CopyFiles libDir // TODO: this is where to glob all releases together + |> copyFilesToLibFolder libDir // Copy all src-files (.cs and .fs files) to workingDir/src let nugetSrcDir = workingDir @@ @"src/" diff --git a/src/NBench.PerformanceCounters/NBench.PerformanceCounters.nuspec b/src/NBench.PerformanceCounters/NBench.PerformanceCounters.nuspec new file mode 100644 index 00000000..22f171ab --- /dev/null +++ b/src/NBench.PerformanceCounters/NBench.PerformanceCounters.nuspec @@ -0,0 +1,24 @@ + + + + @project@ + @project@@title@ + @build.number@ + @authors@ + @authors@ + PerformanceCounter measurements and assertions for NBench + https://github.com/petabridge/NBench/blob/master/LICENSE + https://github.com/petabridge/NBench + false + @releaseNotes@ + @copyright@ + @tags@ + @dependencies@ + @references@ + + + + + + + \ No newline at end of file From 5d82f1fa77a3e15281ab4f08736620376fc1514c Mon Sep 17 00:00:00 2001 From: Nick Chamberlain Date: Tue, 6 Jun 2017 16:16:35 -0400 Subject: [PATCH 06/11] nbench nuspec (doesn't work) --- build.fsx | 9 ++++----- src/NBench/NBench.nuspec | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 src/NBench/NBench.nuspec diff --git a/build.fsx b/build.fsx index 8f6e30b0..02f94c58 100644 --- a/build.fsx +++ b/build.fsx @@ -345,10 +345,6 @@ let createNugetPackages _ = ++ (releaseDir @@ "net452" @@ project + ".pdb") ++ (releaseDir @@ "net452" @@ project + ".xml"), "net452") |] - - - let copyFilesToLibFolder libDir files = - files |> Seq.iter (fun (files, subFolder) -> CopyFiles (libDir @@ subFolder) files) CleanDir workingDir @@ -383,7 +379,10 @@ let createNugetPackages _ = Dependencies = dependencies }) nuspec - // Copy dll, pdb and xml to libdir = workingDir/lib/net45/ + // Copy dll, pdb and xml to libdir = workingDir/lib/net45/ + let copyFilesToLibFolder libDir files = + files |> Seq.iter (fun (files, subFolder) -> CopyFiles (libDir @@ subFolder) files) + let libDir = workingDir @@ @"lib\" printfn "Creating output directory %s" libDir ensureDirectory libDir diff --git a/src/NBench/NBench.nuspec b/src/NBench/NBench.nuspec new file mode 100644 index 00000000..a8aa8667 --- /dev/null +++ b/src/NBench/NBench.nuspec @@ -0,0 +1,24 @@ + + + + @project@ + @project@@title@ + @build.number@ + @authors@ + @authors@ + NBench is a cross-platform automated performance profiling and testing framework for.NET applications. + https://github.com/petabridge/NBench/blob/master/LICENSE + https://github.com/petabridge/NBench + false + @releaseNotes@ + @copyright@ + @tags@ + @dependencies@ + @references@ + + + + + + + \ No newline at end of file From dff596a4589d24185603d1d9fa92d3932ee5ca0a Mon Sep 17 00:00:00 2001 From: Nick Chamberlain Date: Tue, 6 Jun 2017 16:55:01 -0400 Subject: [PATCH 07/11] use dotnet pack for netstanjdard packages since it handles folder structure and file includes --- build.fsx | 20 ++++++++++++++-- .../NBench.PerformanceCounters.nuspec | 24 ------------------- src/NBench/NBench.nuspec | 24 ------------------- 3 files changed, 18 insertions(+), 50 deletions(-) delete mode 100644 src/NBench.PerformanceCounters/NBench.PerformanceCounters.nuspec delete mode 100644 src/NBench/NBench.nuspec diff --git a/build.fsx b/build.fsx index 02f94c58..10af5f62 100644 --- a/build.fsx +++ b/build.fsx @@ -235,7 +235,7 @@ Target "NBench" <| fun _ -> Runtime = "debian.8-x64" Framework = "netcoreapp1.1"}) - let linuxNbenchRunner = __SOURCE_DIRECTORY__ @@ "/src/NBench.Runner.DotNetCli/bin/Release/netcoreapp1.1/debian.8-x64/NBench.Runner" + let linuxNbenchRunner = __SOURCE_DIRECTORY__ @@ "/src/NBench.Runner/bin/Release/netcoreapp1.1/debian.8-x64/NBench.Runner" let linuxPerfAssembly = __SOURCE_DIRECTORY__ @@ "/tests/NBench.Tests.Performance.WithDependencies/bin/Release/netstandard1.6/NBench.Tests.Performance.WithDependencies.dll" let linuxNbenchRunnerArgs = new StringBuilder() @@ -315,6 +315,21 @@ Target "CleanNuget" (fun _ -> // Publish to nuget.org if nugetkey is specified let createNugetPackages _ = + + // For NBench and NBench.Performance counters we use dotnet pack + // because it takes care of the output folder structure + let netstandardProjects = [ "./src/NBench/NBench.csproj"; + "./src/NBench.PerformanceCounters/NBench.PerformanceCounters.csproj"] + + netstandardProjects |> List.iter (fun proj -> + DotNetCli.Pack + (fun p -> + { p with + Project = proj + Configuration = configuration + AdditionalArgs = ["--include-symbols"] + OutputPath = outputNuGet })) + let mutable dirName = 1 let removeDir dir = let del _ = @@ -349,7 +364,8 @@ let createNugetPackages _ = CleanDir workingDir ensureDirectory nugetDir - for nuspec in !! "src/**/*.nuspec" do + // we only do this with NBench.Runner.nuspec + for nuspec in !! "src/**/NBench.Runner.nuspec" do printfn "Creating nuget packages for %s" nuspec let project = Path.GetFileNameWithoutExtension nuspec diff --git a/src/NBench.PerformanceCounters/NBench.PerformanceCounters.nuspec b/src/NBench.PerformanceCounters/NBench.PerformanceCounters.nuspec deleted file mode 100644 index 22f171ab..00000000 --- a/src/NBench.PerformanceCounters/NBench.PerformanceCounters.nuspec +++ /dev/null @@ -1,24 +0,0 @@ - - - - @project@ - @project@@title@ - @build.number@ - @authors@ - @authors@ - PerformanceCounter measurements and assertions for NBench - https://github.com/petabridge/NBench/blob/master/LICENSE - https://github.com/petabridge/NBench - false - @releaseNotes@ - @copyright@ - @tags@ - @dependencies@ - @references@ - - - - - - - \ No newline at end of file diff --git a/src/NBench/NBench.nuspec b/src/NBench/NBench.nuspec deleted file mode 100644 index a8aa8667..00000000 --- a/src/NBench/NBench.nuspec +++ /dev/null @@ -1,24 +0,0 @@ - - - - @project@ - @project@@title@ - @build.number@ - @authors@ - @authors@ - NBench is a cross-platform automated performance profiling and testing framework for.NET applications. - https://github.com/petabridge/NBench/blob/master/LICENSE - https://github.com/petabridge/NBench - false - @releaseNotes@ - @copyright@ - @tags@ - @dependencies@ - @references@ - - - - - - - \ No newline at end of file From c47d2125cdfd01029f9ae0e43d3c244c6af55dbc Mon Sep 17 00:00:00 2001 From: Nick Chamberlain Date: Tue, 6 Jun 2017 17:55:41 -0400 Subject: [PATCH 08/11] try splitting off loadassemblies test as its own class --- .../NBenchIntegrationTest.WithDependencies.cs | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/tests/NBench.Tests.End2End/NBenchIntegrationTest.WithDependencies.cs b/tests/NBench.Tests.End2End/NBenchIntegrationTest.WithDependencies.cs index 066fd8c9..548a4c57 100644 --- a/tests/NBench.Tests.End2End/NBenchIntegrationTest.WithDependencies.cs +++ b/tests/NBench.Tests.End2End/NBenchIntegrationTest.WithDependencies.cs @@ -14,7 +14,7 @@ namespace NBench.Tests.End2End { - public class NBenchIntregrationTestWithDependencies : IDisposable + public class NBenchIntregrationTestWithDependenciesBenchmarks : IDisposable { private static readonly IBenchmarkOutput _benchmarkOutput = new ActionBenchmarkOutput(report => { }, results => { @@ -28,7 +28,7 @@ public class NBenchIntregrationTestWithDependencies : IDisposable private readonly ITestOutputHelper _output; - public NBenchIntregrationTestWithDependencies(ITestOutputHelper output) + public NBenchIntregrationTestWithDependenciesBenchmarks(ITestOutputHelper output) { _output = output; } @@ -50,6 +50,34 @@ public void ShouldPassAllBenchmarks() } } + public void Dispose() + { + if (_discovery != null) + { + _discovery = null; + } + } + } + + public class NBenchIntregrationTestWithDependenciesLoadAssembly : IDisposable + { + private static readonly IBenchmarkOutput _benchmarkOutput = new ActionBenchmarkOutput(report => { }, results => + { + foreach (var assertion in results.AssertionResults) + { + Assert.True(assertion.Passed, results.BenchmarkName + " " + assertion.Message); + } + }); + + private IDiscovery _discovery = new ReflectionDiscovery(_benchmarkOutput); + + private readonly ITestOutputHelper _output; + + public NBenchIntregrationTestWithDependenciesLoadAssembly(ITestOutputHelper output) + { + _output = output; + } + [Fact] public void LoadAssemblyCorrect() { @@ -60,7 +88,7 @@ public void LoadAssemblyCorrect() Assert.Equal(0, result.IgnoredTestsCount); } - private static TestPackage LoadPackageWithDependencies(IEnumerable include = null, IEnumerable exclude = null) + private TestPackage LoadPackageWithDependencies(IEnumerable include = null, IEnumerable exclude = null) { #if CORECLR var assemblySubfolder = "netstandard1.6"; From d2f58ee4879ddfc665862c892f6ae869c97ec3ea Mon Sep 17 00:00:00 2001 From: Nick Chamberlain Date: Tue, 6 Jun 2017 17:59:18 -0400 Subject: [PATCH 09/11] shouldrunallbenchmarks wasn't giving any beneficial feedback so got rid of it --- .../NBenchIntegrationTest.WithDependencies.cs | 68 +------------------ 1 file changed, 2 insertions(+), 66 deletions(-) diff --git a/tests/NBench.Tests.End2End/NBenchIntegrationTest.WithDependencies.cs b/tests/NBench.Tests.End2End/NBenchIntegrationTest.WithDependencies.cs index 548a4c57..035e6f54 100644 --- a/tests/NBench.Tests.End2End/NBenchIntegrationTest.WithDependencies.cs +++ b/tests/NBench.Tests.End2End/NBenchIntegrationTest.WithDependencies.cs @@ -13,64 +13,8 @@ using Xunit.Abstractions; namespace NBench.Tests.End2End -{ - public class NBenchIntregrationTestWithDependenciesBenchmarks : IDisposable +{ public class NBenchIntregrationTestWithDependenciesLoadAssembly { - private static readonly IBenchmarkOutput _benchmarkOutput = new ActionBenchmarkOutput(report => { }, results => - { - foreach (var assertion in results.AssertionResults) - { - Assert.True(assertion.Passed, results.BenchmarkName + " " + assertion.Message); - } - }); - - private IDiscovery _discovery = new ReflectionDiscovery(_benchmarkOutput); - - private readonly ITestOutputHelper _output; - - public NBenchIntregrationTestWithDependenciesBenchmarks(ITestOutputHelper output) - { - _output = output; - } - - [Fact] - public void ShouldPassAllBenchmarks() - { - if (!TestRunner.IsMono) // this spec currently hits a runtime exception with Mono: https://bugzilla.xamarin.com/show_bug.cgi?id=43291 - { - var benchmarks = _discovery.FindBenchmarks(GetType().GetTypeInfo().Assembly).ToList(); - Assert.True(benchmarks.Count >= 1); - Benchmark.PrepareForRun(); // force some GC here - for (var i = 0; i < benchmarks.Count; i++) - { - Benchmark.PrepareForRun(); // force some GC here - benchmarks[i].Run(); - benchmarks[i].Finish(); - } - } - } - - public void Dispose() - { - if (_discovery != null) - { - _discovery = null; - } - } - } - - public class NBenchIntregrationTestWithDependenciesLoadAssembly : IDisposable - { - private static readonly IBenchmarkOutput _benchmarkOutput = new ActionBenchmarkOutput(report => { }, results => - { - foreach (var assertion in results.AssertionResults) - { - Assert.True(assertion.Passed, results.BenchmarkName + " " + assertion.Message); - } - }); - - private IDiscovery _discovery = new ReflectionDiscovery(_benchmarkOutput); - private readonly ITestOutputHelper _output; public NBenchIntregrationTestWithDependenciesLoadAssembly(ITestOutputHelper output) @@ -88,7 +32,7 @@ public void LoadAssemblyCorrect() Assert.Equal(0, result.IgnoredTestsCount); } - private TestPackage LoadPackageWithDependencies(IEnumerable include = null, IEnumerable exclude = null) + private static TestPackage LoadPackageWithDependencies(IEnumerable include = null, IEnumerable exclude = null) { #if CORECLR var assemblySubfolder = "netstandard1.6"; @@ -105,13 +49,5 @@ private TestPackage LoadPackageWithDependencies(IEnumerable include = nu package.Validate(); return package; } - - public void Dispose() - { - if (_discovery != null) - { - _discovery = null; - } - } } } From e557ded5dc36660afb655167d6956a5448f364f2 Mon Sep 17 00:00:00 2001 From: Nick Chamberlain Date: Tue, 6 Jun 2017 18:13:55 -0400 Subject: [PATCH 10/11] ignore integraion test on Mono for now --- .../NBenchIntegrationTest.WithDependencies.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/NBench.Tests.End2End/NBenchIntegrationTest.WithDependencies.cs b/tests/NBench.Tests.End2End/NBenchIntegrationTest.WithDependencies.cs index 035e6f54..5fdce804 100644 --- a/tests/NBench.Tests.End2End/NBenchIntegrationTest.WithDependencies.cs +++ b/tests/NBench.Tests.End2End/NBenchIntegrationTest.WithDependencies.cs @@ -25,11 +25,14 @@ public NBenchIntregrationTestWithDependenciesLoadAssembly(ITestOutputHelper outp [Fact] public void LoadAssemblyCorrect() { - var package = LoadPackageWithDependencies(); - var result = TestRunner.Run(package); - Assert.True(result.AllTestsPassed); - Assert.NotEqual(0, result.ExecutedTestsCount); - Assert.Equal(0, result.IgnoredTestsCount); + if (!TestRunner.IsMono) // this test doesn't pass yet on Mono + { + var package = LoadPackageWithDependencies(); + var result = TestRunner.Run(package); + Assert.True(result.AllTestsPassed); + Assert.NotEqual(0, result.ExecutedTestsCount); + Assert.Equal(0, result.IgnoredTestsCount); + } } private static TestPackage LoadPackageWithDependencies(IEnumerable include = null, IEnumerable exclude = null) From 836e705693cecdf2fb5cc73d0ffc8fdfa2b4329b Mon Sep 17 00:00:00 2001 From: Nick Chamberlain Date: Wed, 7 Jun 2017 14:41:17 -0400 Subject: [PATCH 11/11] v1.0.3 release notes --- README.md | 44 ++++++++++++++++++++++++++++++++++---------- RELEASE_NOTES.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 582e8e7b..af3a98c3 100644 --- a/README.md +++ b/README.md @@ -55,32 +55,56 @@ After defining some NBench `PerfBenchmark` methods and declaring some measuremen ### .NET 4.5.2 Runner -To install the .NET 4.5.2 NBench runner via NuGet: +The NBench Runner NuGet package now contains executables that support .NET 4.5.2, .NET Core 1.1/win7-x64, and .NET Core 1.1/debian8-x64 benchmark assembly targets. Before v1.0.3, you would expect the NBench.Runner NuGet package to contain a single executable that works with .NET 4.5.2: + +``` +lib/ + net45/ + NBench.Runner.exe +``` + +With the additional .NET Core executables, you will now get two additional subfolders in your downloaded package: + +``` +lib/ + net452/ + NBench.Runner.exe + netcoreapp1.1/ + win7-x64/ + NBench.Runner.exe + debian8-x64/ + NBench.Runner +``` + +You may choose the appropriate executable for your benchmark assembly/architecture combination + +To install and execute the NBench Runner against a .NET 4.5.2 benchmark assembly, you would execute the following: ``` PS> Install-Package NBench.Runner -PS> .\packages\NBench.Runner\NBench.Runner.exe .\src\bin\Debug\MyPerfTests.dll output-directory="C:\Perf" +PS> <--packageLocation-->\NBench.Runner\lib\net452\NBench.Runner.exe <--benchmarkProjectLocation-->\bin\Debug\net452\MyPerfTests.dll output-directory="C:\Perf" ``` + And this command will run your `PerfBenchmark` and write output [that looks like this](https://gist.github.com/Aaronontheweb/8e0bfa2cccc63f5bd8bf) to a markdown file in the `output-directory`. ### .NET Core Runner -NBench 1.0.0 has a separate runner for projects that target .NET Core 1.0. It is installed on a per-project basis via NuGet by adding a `` to your test project's `.csproj` file: +If you have compiled a benchmark assembly that targets .NET Core 1.1, you may use the appropriate executable from the lib/netcoreap1.1 folder of the downloaded NBench.Runner NuGet package; + +On 64-bit Windows: ``` - - - +PS> Install-Package NBench.Runner +PS> <--packageLocation-->\NBench.Runner\lib\netcoreapp1.1\win7-x64\NBench.Runner.exe <--benchmarkProjectLocation-->\bin\Debug\netcoreapp1.1\MyPerfTests.dll output-directory="C:\Perf" ``` -After adding this reference, run `dotnet restore` and the NBench .NET Core runner will be installed for your project. To run the tests, open a command prompt and navigate to the project's parent folder. You can now run the following command, passing the same arguments as `NBench.Runner.exe`: +On 64-bit Debian 8: ``` -PS> dotnet nbench .\src\bin\Debug\MyPerfTests.dll output-directory="C:\Perf" +PS> Install-Package NBench.Runner +PS> <--packageLocation-->\NBench.Runner\lib\netcoreapp1.1\debian8-x64\NBench.Runner.exe <--benchmarkProjectLocation-->\bin\Debug\netcoreapp1.1\MyPerfTests.dll output-directory="C:\Perf" ``` -**NOTE:** Your shell's working directory must be inside the folder containing the .csproj file with the above `` in order to run `dotnet nbench`. - ## Command Line Parameters ``` NBench.Runner.exe [assembly names] [output-directory={dir-path}] [configuration={file-path}] [include=MyTest*.Perf*,Other*Spec] [exclude=*Long*] [concurrent={true|false}] diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 39a18cba..a1a18972 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,50 @@ +#### v1.0.3 June 7 2017 + +This release resolves issues with NuGet deployment of the dedicated NBench.Runner.DotNetCli runner that was originally designed to be used for .NET Core projects. The issue is detailed by [#200](https://github.com/petabridge/NBench/issues/200) and resolved with PR [#201](https://github.com/petabridge/NBench/pull/201). + +Important breaking change: + +NBench.Runner.DotNetCli is being deprecated (temporarily) as the supported means of running the NBench runner with a benchmark assembly that targets .NET Core. Instead, the original [NBench.Runner](https://www.nuget.org/packages/NBench.Runner/) will come packaged with 2 additional executables that are compatible with .NET Core. Originally, per the instructions on the README, to run the **.NET 4.5.2** you would run the following commands: + +``` +PS> Install-Package NBench.Runner +PS> .\packages\NBench.Runner\NBench.Runner.exe .\src\bin\Debug\MyPerfTests.dll output-directory="C:\Perf +``` + +Since the new NBench.Runner NuGet package ships the additional .NET Core runner, the folder structure of the downloaded runner is as follows: + +lib/ + net452/ + NBench.Runner.exe + netcoreapp1.1/ + win7-x64/ + NBench.Runner.exe + debian8-x64/ + NBench.Runner + +The above way to run the .NET 4.5.2 runner, hence, changes to: + +``` +PS> Install-Package NBench.Runner +PS> .\packages\NBench.Runner\lib\net452\NBench.Runner.exe .\src\bin\Debug\net452\MyPerfTests.dll output-directory="C:\Perf +``` + +For .NET Core support (meaning running a benchmark that has been targeted for `netcoreapp1.1` or `netstandard1.6`, you will run the appropriate NBench.Runner.exe for your architecture: + +``` +PS> Install-Package NBench.Runner +PS> .\packages\NBench.Runner\lib\netcoreapp1.1\win7-x64\NBench.Runner.exe .\src\bin\Debug\netcoreapp1.1\MyPerfTests.dll output-directory="C:\Perf +``` + +or, on Debian 8: + +``` +PS> Install-Package NBench.Runner +PS> .\packages\NBench.Runner\lib\netcoreapp1.1\debian8-x64\NBench.Runner.exe .\src\bin\Debug\netcoreapp1.1\MyPerfTests.dll output-directory="C:\Perf +``` + +Plans will be made to re-introduce support for NBench.Runner.DotNetCli which allows for the usage of NBench as a `DotNetCliToolReference`. + #### v1.0.2 May 31 2017 This release resolves issues: [#182](https://github.com/petabridge/NBench/issues/182) and [#192](https://github.com/petabridge/NBench/issues/192) relating to the NBench.Runner.DotNetCli (the NBench Runner that can execute benchmarks for assemblies that target .NET Core). The root cause was that the runner was unable to execute .NET Core benchmarks that had external dependencies.