Skip to content

Commit

Permalink
use Nerdbank.GitVersioning to automate generation of assembly and nug…
Browse files Browse the repository at this point in the history
…et package versions
  • Loading branch information
AndrewKostousov committed Sep 14, 2018
1 parent 6383e2a commit cbebd67
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 12 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 4 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="2.2.13" PrivateAssets="All" />
</ItemGroup>

</Project>
13 changes: 13 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,17 @@
</ItemGroup>
</Target>

<Target Name="SetNuSpecProperties" BeforeTargets="GenerateNuspec" DependsOnTargets="GetBuildVersion">
<PropertyGroup>
<PackageId>$(AssemblyName)</PackageId>
<Authors>Igor Chevdar</Authors>
<PackageTags>binary serializer</PackageTags>
<Description>GroBuf is a fast binary serializer for .NET</Description>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/skbkontur/GroBuf</RepositoryUrl>
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
<PackageReleaseNotes>$(RepositoryUrl)/releases/tag/v$(MajorMinorVersion)-release</PackageReleaseNotes>
</PropertyGroup>
</Target>

</Project>
10 changes: 0 additions & 10 deletions GroBuf/GroBuf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageId>$(AssemblyName)</PackageId>
<VersionPrefix>1.3.2</VersionPrefix>
<Version>$(VersionPrefix)</Version>
<AssemblyVersion>$(VersionPrefix).0</AssemblyVersion>
<Authors>Igor Chevdar</Authors>
<PackageTags>binary serializer</PackageTags>
<Description>GroBuf is a fast binary serializer for .NET</Description>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/skbkontur/GroBuf</RepositoryUrl>
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

```
Expand All @@ -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
Expand Down Expand Up @@ -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).
44 changes: 44 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,58 @@
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
- cmd: dotnet restore ./GroBuf.sln --verbosity m

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
20 changes: 20 additions & 0 deletions version.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}

0 comments on commit cbebd67

Please sign in to comment.