From cbebd67525d10d72c1d61a732c8b52e48a94aacb Mon Sep 17 00:00:00 2001 From: avk Date: Fri, 14 Sep 2018 19:04:59 +0500 Subject: [PATCH] use Nerdbank.GitVersioning to automate generation of assembly and nuget package versions --- .travis.yml | 1 + CHANGELOG.md | 10 ++++++++++ Directory.Build.props | 4 ++++ Directory.Build.targets | 13 ++++++++++++ GroBuf/GroBuf.csproj | 10 ---------- README.md | 8 ++++++-- appveyor.yml | 44 +++++++++++++++++++++++++++++++++++++++++ version.json | 20 +++++++++++++++++++ 8 files changed, 98 insertions(+), 12 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 version.json diff --git a/.travis.yml b/.travis.yml index 05e4c8e..e3523fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ language: csharp dotnet: 2.1.400 mono: none script: + - git fetch --unshallow # in order to make Nerdbank.GitVersioning.Tasks.GetBuildVersion work - dotnet restore ./GroBuf.sln --verbosity m - dotnet build --configuration Release --framework netstandard2.0 ./GroBuf/GroBuf.csproj - dotnet build --configuration Release --framework netcoreapp2.0 ./GroBuf.Tests/GroBuf.Tests.csproj diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..3bd0e87 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog + +## v1.4 - 2018.09.14 +- Use [Nerdbank.GitVersioning](https://github.com/AArnott/Nerdbank.GitVersioning) to automate generation of assembly + and nuget package versions. +- Fix GroBuf to work on .NET Core 2.1 runtime on Linux. + +## v1.3 - 2018.01.06 +- Support .NET Standard 2.0. +- Switch to SDK-style project format and dotnet core build tooling. diff --git a/Directory.Build.props b/Directory.Build.props index 74e410f..ce9c32a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -12,4 +12,8 @@ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + + + + \ No newline at end of file diff --git a/Directory.Build.targets b/Directory.Build.targets index cb19e7e..b5c8b27 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -7,4 +7,17 @@ + + + $(AssemblyName) + Igor Chevdar + binary serializer + GroBuf is a fast binary serializer for .NET + git + https://github.com/skbkontur/GroBuf + $(RepositoryUrl) + $(RepositoryUrl)/releases/tag/v$(MajorMinorVersion)-release + + + \ No newline at end of file diff --git a/GroBuf/GroBuf.csproj b/GroBuf/GroBuf.csproj index af23ac5..59174a0 100644 --- a/GroBuf/GroBuf.csproj +++ b/GroBuf/GroBuf.csproj @@ -3,16 +3,6 @@ netstandard2.0;net45 true - $(AssemblyName) - 1.3.2 - $(VersionPrefix) - $(VersionPrefix).0 - Igor Chevdar - binary serializer - GroBuf is a fast binary serializer for .NET - git - https://github.com/skbkontur/GroBuf - $(RepositoryUrl) diff --git a/README.md b/README.md index 569955d..d084f54 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ public enum CarKind : byte } ``` -## Creating a serializer +### Creating a serializer In order to obtain maximum speed it is strongly recommended to once create a serializer as it uses dynamic code generation for serializers/deserializers. ``` @@ -43,7 +43,7 @@ var serializer = new Serializer(new PropertiesExtractor(), options : GroBufOptio Here we create serializer in order to read/write all public properties. By default GroBuf skips objects which are empty (an object is considered empty if it is an array with zero length or if all its members are empty). The [GroBufOptions.WriteEmptyObjects](https://github.com/homuroll/GroBuf/blob/master/GroBuf/GroBuf/GroBufOptions.cs) options says GroBuf to write all data as is. -## Serializing/Deserializing +### Serializing/Deserializing GroBuf serializes objects to binary format and returns byte[], deserializes from byte[]: ``` var car = new Car @@ -126,3 +126,7 @@ Type=ProtoBufvsGroBufRunner Mode=Throughput The disadvantages are: - because of simpler format the size of data produced by GroBuf is 1.5-2 times larger than ProtoBuf's. But it is planned to be optimized in the future - lack of ProtoBuf's extensions + +## Release Notes + +See [CHANGELOG](CHANGELOG.md). diff --git a/appveyor.yml b/appveyor.yml index 2b960ce..bee77a4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,29 @@ +version: '{build}' + +skip_commits: + files: + - '**/*.md' + image: Visual Studio 2017 init: - cmd: git config --global core.autocrlf false + - ps: | + $ErrorActionPreference = "Stop" + $tagName = $env:APPVEYOR_REPO_TAG_NAME + if ($tagName -match '^v\d+\.\d+') # tag name starts with 'vX.Y' + { + $env:SHOULD_PUBLISH_NUGET_PACKAGE = "true" + Write-Host "Will publish nuget package for $tagName tag" -ForegroundColor "Green" + if ($tagName -match '^v\d+\.\d+-release$') # tag name matches 'vX.Y-release' + { + $env:SHOULD_CREATE_RELEASE = "true" + Write-Host "Will create release for $tagName tag" -ForegroundColor "Green" + } + } + +nuget: + disable_publish_on_pr: true before_build: - cmd: dotnet --info @@ -9,6 +31,28 @@ before_build: build_script: - cmd: dotnet build --configuration Release ./GroBuf.sln + - cmd: dotnet pack --no-build --configuration Release ./GroBuf.sln test_script: - cmd: dotnet test --no-build --configuration Release --filter TestCategory!=LongRunning ./GroBuf.Tests/GroBuf.Tests.csproj + +artifacts: + - path: './GroBuf/bin/Release/*.nupkg' + +deploy: + - provider: NuGet + server: https://nuget.org + api_key: + secure: dzTnT0xSlPrHnrG06cj354nTN4lXWhfh4ZCJ1910I3VnNdvbx0rQFLTyJ5l1+bgB + skip_symbols: true + on: + SHOULD_PUBLISH_NUGET_PACKAGE: true + + - provider: GitHub + tag: $(APPVEYOR_REPO_TAG_NAME) + auth_token: + secure: y8dDOcAtq4U1MTDJFX8f23xsvyFU1u4bhwr9Lzbkf2revNWPPTifBkWghris9v8i + draft: false + prerelease: false + on: + SHOULD_CREATE_RELEASE: true diff --git a/version.json b/version.json new file mode 100644 index 0000000..50e008f --- /dev/null +++ b/version.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "version": "1.4", + "assemblyVersion": { + "precision": "build" + }, + "publicReleaseRefSpec": [ + "^refs/heads/master$", + "^refs/tags/v\\d+\\.\\d+" + ], + "nugetPackageVersion": { + "semVer": 2 + }, + "cloudBuild": { + "setVersionVariables": true, + "buildNumber": { + "enabled": false + } + } +} \ No newline at end of file