From 33854067d44c24937cf1f4b633bf8fd397e59c5a Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Sun, 29 Jan 2017 15:14:31 +0000 Subject: [PATCH] #20 - Tidy up. Update command line scripts. Fix running benchmarks. --- Ocelot.sln | 10 +++---- build-and-release-unstable.ps1 | 1 + build-and-run-tests.bat | 2 -- build-and-run-tests.ps1 | 1 + build.bat | 8 ------ build.cake | 52 ++++++++++++++++++---------------- run-acceptance-tests.bat | 8 ------ run-acceptance-tests.ps1 | 1 + run-benchmarks.bat | 15 ---------- run-benchmarks.ps1 | 1 + run-tests.bat | 2 -- run-unit-tests.bat | 8 ------ run-unit-tests.ps1 | 1 + test.txt | 1 - 14 files changed, 37 insertions(+), 74 deletions(-) create mode 100644 build-and-release-unstable.ps1 delete mode 100755 build-and-run-tests.bat create mode 100644 build-and-run-tests.ps1 delete mode 100755 build.bat delete mode 100755 run-acceptance-tests.bat create mode 100644 run-acceptance-tests.ps1 delete mode 100644 run-benchmarks.bat create mode 100644 run-benchmarks.ps1 delete mode 100755 run-tests.bat delete mode 100755 run-unit-tests.bat create mode 100644 run-unit-tests.ps1 delete mode 100644 test.txt diff --git a/Ocelot.sln b/Ocelot.sln index 282c7120a..2f8fd206e 100644 --- a/Ocelot.sln +++ b/Ocelot.sln @@ -9,21 +9,19 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject .gitignore = .gitignore appveyor.yml = appveyor.yml - build-and-run-tests.bat = build-and-run-tests.bat - build.bat = build.bat + build-and-run-tests.ps1 = build-and-run-tests.ps1 build.cake = build.cake build.ps1 = build.ps1 configuration-explanation.txt = configuration-explanation.txt global.json = global.json LICENSE.md = LICENSE.md Ocelot.nuspec = Ocelot.nuspec - push-to-nuget.bat = push-to-nuget.bat README.md = README.md release.ps1 = release.ps1 - run-acceptance-tests.bat = run-acceptance-tests.bat + run-acceptance-tests.ps1 = run-acceptance-tests.ps1 run-benchmarks.bat = run-benchmarks.bat - run-tests.bat = run-tests.bat - run-unit-tests.bat = run-unit-tests.bat + run-benchmarks.ps1 = run-benchmarks.ps1 + run-unit-tests.ps1 = run-unit-tests.ps1 EndProjectSection EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Ocelot", "src\Ocelot\Ocelot.xproj", "{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}" diff --git a/build-and-release-unstable.ps1 b/build-and-release-unstable.ps1 new file mode 100644 index 000000000..9a29f95f5 --- /dev/null +++ b/build-and-release-unstable.ps1 @@ -0,0 +1 @@ +./build.ps1 -target build-full \ No newline at end of file diff --git a/build-and-run-tests.bat b/build-and-run-tests.bat deleted file mode 100755 index 764682b65..000000000 --- a/build-and-run-tests.bat +++ /dev/null @@ -1,2 +0,0 @@ -./run-tests.bat -./build.bat \ No newline at end of file diff --git a/build-and-run-tests.ps1 b/build-and-run-tests.ps1 new file mode 100644 index 000000000..f82502e58 --- /dev/null +++ b/build-and-run-tests.ps1 @@ -0,0 +1 @@ +./build.ps1 -target RunTests \ No newline at end of file diff --git a/build.bat b/build.bat deleted file mode 100755 index 656515d42..000000000 --- a/build.bat +++ /dev/null @@ -1,8 +0,0 @@ -echo ------------------------- - -echo Building Ocelot -dotnet restore src/Ocelot -dotnet build src/Ocelot -c Release - - - diff --git a/build.cake b/build.cake index 0781fcfc0..3fbeeaf74 100644 --- a/build.cake +++ b/build.cake @@ -2,21 +2,15 @@ #tool "nuget:?package=OpenCover" #tool "nuget:?package=ReportGenerator" #tool "nuget:?package=GitReleaseNotes" -#addin nuget:?package=Cake.DoInDirectory -#addin "Cake.Json" +#addin "nuget:?package=Cake.DoInDirectory" +#addin "nuget:?package=Cake.Json" -var target = Argument("target", "Default"); -var artifactsDir = Directory("artifacts"); - -Information("target is " +target); - -// versioning -var committedVersion = "0.0.0-dev"; -var buildVersion = committedVersion; - -//compile +// compile var compileConfig = Argument("configuration", "Release"); -Information("Build configuration is " + compileConfig); +var projectJson = "./src/Ocelot/project.json"; + +// build artifacts +var artifactsDir = Directory("artifacts"); // unit testing var artifactsForUnitTestsDir = artifactsDir + Directory("UnitTests"); @@ -31,32 +25,42 @@ var artifactsForBenchmarkTestsDir = artifactsDir + Directory("BenchmarkTests"); var benchmarkTestAssemblies = @"./test/Ocelot.Benchmarks"; // packaging -var projectJson = "./src/Ocelot/project.json"; var packagesDir = artifactsDir + Directory("Packages"); var releaseNotesFile = packagesDir + File("releasenotes.md"); var artifactsFile = packagesDir + File("artifacts.txt"); -//unstable releases -var publishUnstableBuilds = true; +// unstable releases var nugetFeedUnstableKey = EnvironmentVariable("nuget-apikey-unstable"); var nugetFeedUnstableUploadUrl = "https://www.myget.org/F/ocelot-unstable/api/v2/package"; var nugetFeedUnstableSymbolsUploadUrl = "https://www.myget.org/F/ocelot-unstable/symbols/api/v2/package"; -//stable releases +// stable releases var tagsUrl = "https://api.github.com/repos/binarymash/ocelot/releases/tags/"; -var releaseTag = ""; var nugetFeedStableKey = EnvironmentVariable("nuget-apikey-stable"); var nugetFeedStableUploadUrl = "https://www.myget.org/F/ocelot-stable/api/v2/package"; var nugetFeedStableSymbolsUploadUrl = "https://www.myget.org/F/ocelot-stable/symbols/api/v2/package"; +// internal build variables - don't change these. +var releaseTag = ""; +var buildVersion = committedVersion; +var committedVersion = "0.0.0-dev"; + +var target = Argument("target", "Default"); + +Information("target is " +target); +Information("Build configuration is " + compileConfig); + Task("Default") + .IsDependentOn("Build"); + +Task("Build") .IsDependentOn("RunTests") - .IsDependentOn("CreatePackages") - .IsDependentOn("ReleasePackagesToUnstableFeed") - .Does(() => - { - }); + .IsDependentOn("CreatePackages"); +Task("BuildAndReleaseUnstable") + .IsDependentOn("Build") + .IsDependentOn("ReleasePackagesToUnstableFeed"); + Task("Clean") .Does(() => { @@ -138,7 +142,7 @@ Task("RunBenchmarkTests") DoInDirectory(benchmarkTestAssemblies, () => { - DotNetCoreRun(".", "--args", buildSettings); + DotNetCoreRun(".", "", buildSettings); }); }); diff --git a/run-acceptance-tests.bat b/run-acceptance-tests.bat deleted file mode 100755 index ba8a3489d..000000000 --- a/run-acceptance-tests.bat +++ /dev/null @@ -1,8 +0,0 @@ -echo Running Ocelot.AcceptanceTests -cd test/Ocelot.AcceptanceTests/ -dotnet restore -dotnet test -cd ../../ - -echo Restoring Ocelot.ManualTest -dotnet restore test/Ocelot.ManualTest/ \ No newline at end of file diff --git a/run-acceptance-tests.ps1 b/run-acceptance-tests.ps1 new file mode 100644 index 000000000..480e1d4cd --- /dev/null +++ b/run-acceptance-tests.ps1 @@ -0,0 +1 @@ +./build -target RunAcceptanceTests \ No newline at end of file diff --git a/run-benchmarks.bat b/run-benchmarks.bat deleted file mode 100644 index 1376f17a1..000000000 --- a/run-benchmarks.bat +++ /dev/null @@ -1,15 +0,0 @@ -echo ------------------------- - -echo Running Ocelot.Benchmarks - -cd test/Ocelot.Benchmarks - -dotnet restore - -dotnet run - -cd ../../ - - - - diff --git a/run-benchmarks.ps1 b/run-benchmarks.ps1 new file mode 100644 index 000000000..e05490fd2 --- /dev/null +++ b/run-benchmarks.ps1 @@ -0,0 +1 @@ +./build.ps1 -target RunBenchmarkTests \ No newline at end of file diff --git a/run-tests.bat b/run-tests.bat deleted file mode 100755 index 39532229a..000000000 --- a/run-tests.bat +++ /dev/null @@ -1,2 +0,0 @@ -./run-unit-tests.bat -./run-acceptance-tests.bat \ No newline at end of file diff --git a/run-unit-tests.bat b/run-unit-tests.bat deleted file mode 100755 index 9ad6a4f2d..000000000 --- a/run-unit-tests.bat +++ /dev/null @@ -1,8 +0,0 @@ -echo ------------------------- - -echo Restoring Ocelot -dotnet restore src/Ocelot - -echo Running Ocelot.UnitTests -dotnet restore test/Ocelot.UnitTests/ -dotnet test test/Ocelot.UnitTests/ diff --git a/run-unit-tests.ps1 b/run-unit-tests.ps1 new file mode 100644 index 000000000..0e6a91bd1 --- /dev/null +++ b/run-unit-tests.ps1 @@ -0,0 +1 @@ +./build.ps1 -target RunUnitTests \ No newline at end of file diff --git a/test.txt b/test.txt deleted file mode 100644 index 30d74d258..000000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -test \ No newline at end of file