Skip to content

Commit

Permalink
minimum readme
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Sep 25, 2022
1 parent 0b7eed7 commit adf72cb
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 3 deletions.
71 changes: 70 additions & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -1 +1,70 @@
name: Build-Release
name: Build-Release

on:
workflow_dispatch:
inputs:
tag:
description: "tag: git tag you want create. (sample 1.0.0)"
required: true
dry-run:
description: "dry-run: true will never create release/nuget."
required: true
default: "false"

env:
GIT_TAG: ${{ github.event.inputs.tag }}
DRY_RUN: ${{ github.event.inputs.dry-run }}

jobs:
build-dotnet:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
with:
dotnet-version: '7.0' # require 7.0-rc
include-prerelease: 'true'
# pack nuget
- run: dotnet build -c Release -p:Version=${{ env.GIT_TAG }}
- run: dotnet test -c Release --no-build
- run: dotnet pack -c Release --no-build -p:Version=${{ env.GIT_TAG }} -o ./publish
- uses: actions/upload-artifact@v2
with:
name: nuget
path: ./publish

create-release:
if: github.event.inputs.dry-run == 'false'
needs: [build-dotnet]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# tag
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
with:
dotnet-version: '7.0' # require 7.0-rc
include-prerelease: 'true'
- uses: actions/checkout@v3
- name: tag
run: git tag ${{ env.GIT_TAG }}
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: true
# Create Releases
- uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.GIT_TAG }}
release_name: Ver.${{ env.GIT_TAG }}
draft: true
prerelease: false
# Download (All) Artifacts to current directory
- uses: actions/download-artifact@v2
# Upload to NuGet
- run: dotnet nuget push "./nuget/*.nupkg" -s https://www.nuget.org/api/v2/package -k ${{ secrets.NUGET_KEY }}
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,47 @@
# MemoryPack
[![GitHub Actions](https://github.com/Cysharp/MemoryPack/workflows/Build-Debug/badge.svg)](https://github.com/Cysharp/MemoryPack/actions) [![Releases](https://img.shields.io/github/release/Cysharp/MemoryPack.svg)](https://github.com/Cysharp/MemoryPack/releases)

Ideally fast no encoding binary serializer for .NET.
Zero encoding binary serializer for C#.

Currently preview.

Installation
---
This library is distributed via NuGet. Minimum requirement is `.NET 7 RC1` and Roslyn Incremental Generator(`4.4.0-1.final`) support.

> PM> Install-Package [MemoryPack](https://www.nuget.org/packages/MemoryPack)
And you need to enable preview features to `.csproj`.

```xml
<EnablePreviewFeatures>True</EnablePreviewFeatures>
```

Quick Start
---
Define the struct or class to be serialized and annotate it with a `[MemoryPackable]` attribute and `partial` keyword.

```csharp
[MemoryPackable]
public partial class MyClass
{
public int MyProperty1 { get; set; }
public int MyProperty2 { get; set; }
}
```

MemoryPack code generator generates `IMemoryPackable<T>` static abstract member.

In Visual Studio, you can check generated code via `Ctrl+K, R` on class name and select `*.MemoryPackFormatter.g.cs`.

`<EnablePreviewFeatures>True</EnablePreviewFeatures>`
Call `MemoryPackSerializer.Serialize<T>/Deserialize<T>` to serialize/deserialize your object instance.

```csharp
var v = new MyClass { MyProperty1 = 10, MyProperty2 = 40 };

var bin = MemoryPackSerializer.Serialize(v);
var v2 = MemoryPackSerializer.Deserialize<MyClass>(bin);
```

wire format
---
Expand Down
2 changes: 2 additions & 0 deletions sandbox/Benchmark/Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<EnablePreviewFeatures>True</EnablePreviewFeatures>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
1 change: 1 addition & 0 deletions sandbox/SandboxConsoleApp/SandboxConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnablePreviewFeatures>True</EnablePreviewFeatures>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/MemoryPack.Streaming/MemoryPack.Streaming.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!-- TODO: Currently not publish but will publish... -->
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit adf72cb

Please sign in to comment.