Permalink
Browse files

Use make for build automation

  • Loading branch information...
yevhen committed Nov 12, 2017
1 parent ceb82e8 commit ea157b1ed79051b7e57ae2127da4c7ecc9c5e8ee
Showing with 40 additions and 76 deletions.
  1. +36 −0 Makefile
  2. +0 −8 Nake.bat
  3. +0 −60 Nake.csx
  4. +3 −7 README.md
  5. +1 −1 appveyor.yml
View
@@ -0,0 +1,36 @@
+PROJECT=Streamstone
+OUT_DIR=$(CURDIR)/Output
+VERSION=$(shell cat $(CURDIR)/Source/Streamstone.Version.cs | grep -oP [0-9]\.[0-9]\.[0-9] | uniq)
+
+nuget=$(CURDIR)/Tools/Nuget.exe
+nunit-test-results=nunit-test-results.trx
+
+default: package
+
+build-debug:
+ @dotnet build ${PROJECT}.sln /p:Configuration=Debug
+
+build-release:
+ @dotnet build ${PROJECT}.sln /p:Configuration=Release
+
+verify:
+ @dotnet test Source/**/*.Tests.csproj --configuration Debug \
+ -l:trx\;LogFileName=${nunit-test-results} \
+ --results-directory ${OUT_DIR}
+
+package: verify build-release
+ @${nuget} pack ${CURDIR}/Source/${PROJECT}/${PROJECT}.nuspec \
+ -Version ${VERSION} \
+ -OutputDirectory ${OUT_DIR} \
+ -BasePath ${CURDIR}/Source/Streamstone/bin/Release \
+ -NoPackageAnalysis
+
+ $(if $(filter $(APPVEYOR),True), \
+ @curl -XPOST --data-binary $(OUT_DIR)/$(nunit-test-results) \
+ https://ci.appveyor.com/api/testresults/mstest/$(APPVEYOR_JOB_ID))
+
+publish:
+ @dotnet nuget push ${OUT_DIR}/${PROJECT}.${VERSION}.nupkg --api-key $(NuGetApiKey) --source https://nuget.org/
+
+version:
+ @echo $(VERSION)
View
@@ -1,8 +0,0 @@
-@ECHO OFF
-
-SET DIR=%~dp0.
-SET NAKE_VERSION=2.4.0
-SET NAKE_RUNNER=%DIR%\Packages\Nake.%NAKE_VERSION%\tools\net45\Nake.exe
-
-IF NOT EXIST "%NAKE_RUNNER%" "%DIR%\Tools\NuGet.exe" install Nake -Version %NAKE_VERSION% -o "%DIR%\Packages"
-"%NAKE_RUNNER%" -f "%DIR%\Nake.csx" -d "%DIR%" %*
View
@@ -1,60 +0,0 @@
-#r "System.Xml"
-#r "System.Xml.Linq"
-
-using System.Linq;
-using System.Net;
-using System.Xml.Linq;
-using System.Diagnostics;
-using System.Text.RegularExpressions;
-
-using static Nake.App;
-using static Nake.Env;
-using static Nake.FS;
-using static Nake.Log;
-using static Nake.Run;
-
-const string Project = "Streamstone";
-const string RootPath = "%NakeScriptDirectory%";
-const string OutputPath = RootPath + @"\Output";
-
-var AppVeyor = Var["APPVEYOR"] == "True";
-
-/// Builds sources in Debug mode
-[Task] void Default() => Build();
-
-/// Builds sources using specified configuration and output path
-[Step] void Build(string config = "Debug") =>
- Exec("dotnet", "build {Project}.sln /p:Configuration={config}");
-
-/// Runs unit tests
-[Step] void Test()
-{
- Exec("dotnet", "test Source/Streamstone.Tests/Streamstone.Tests.csproj --configuration Debug -l:trx;LogFileName=nunit-test-results.trx --results-directory \"{OutputPath}\"");
-
- var results = @"{OutputPath}\nunit-test-results.trx";
- if (AppVeyor)
- new WebClient().UploadFile("https://ci.appveyor.com/api/testresults/mstest/%APPVEYOR_JOB_ID%", results);
-}
-
-/// Builds official NuGet package
-[Step] void Package()
-{
- Test();
-
- Build("Release");
-
- Cmd(@"Tools\Nuget.exe pack Source\Streamstone\{Project}.nuspec -Version {Version()} " +
- @"-OutputDirectory {OutputPath} -BasePath {RootPath}\Source\Streamstone\bin\Release -NoPackageAnalysis");
-}
-
-/// Publishes package to NuGet gallery
-[Step] void Publish() => Cmd(@"Tools\Nuget.exe push {OutputPath}\{Project}.{Version()}.nupkg %NuGetApiKey% -Source https://nuget.org/");
-
-string Version()
-{
- var version = File
- .ReadAllLines(@"{RootPath}\Source\Streamstone.Version.cs")
- .First(x => x.StartsWith("[assembly: AssemblyVersion("));
-
- return new Regex(@"AssemblyVersion\(\""([^\""]*)\""\)").Match(version).Groups[1].Value;
-}
View
@@ -25,15 +25,11 @@ To install Streamstone via NuGet, run this command in NuGet package manager cons
## Building from source [![Build status](https://ci.appveyor.com/api/projects/status/3rsmwblor11b6inq/branch/master?svg=true)](https://ci.appveyor.com/project/yevhen/streamstone/branch/master)
-Currently, automated build scripts can be run only on Windows but it's possible to produce binary on Linux by using dotnet cli tooling (ie `dotnet build`). To build Streamstone binaries on Windows you will need to have Visual Studio 17 Update 3 or higher and .NET Core SDK 2.0 or higher.
+To build Streamstone binaries on Windows you will need to have Visual Studio 17 Update 3 or higher and .NET Core SDK 2.0 or higher. To build binaries on Linux use dotnet cli tooling (ie `dotnet build`).
-To build Streamstone from cli on Windows, run the following command from solution's root directory:
+## Running unit tests
- > Nake.bat package
-
-For a list of available commands run `Nake.bat -T`.
-
-> NOTE: Unit tests require Azure Storage Emulator 5.2 or higher. Alternatively, you could run against real storage by setting storage account connection string to **Streamstone-Test-Storage** user-level environment variable.
+Unit tests require Azure Storage Emulator 5.2 or higher, which is currently available only on Windows. Alternatively, you could run against real Azure by setting storage account connection string to **Streamstone-Test-Storage** user-level environment variable.
## Design
View
@@ -9,7 +9,7 @@ build_script:
- cmd: >-
"C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" start
- Nake.bat package
+ C:\cygwin\make.exe package
test: off
artifacts:
- path: Output\Package\*.nupkg

0 comments on commit ea157b1

Please sign in to comment.