Skip to content

Commit adf72cb

Browse files
committed
minimum readme
1 parent 0b7eed7 commit adf72cb

File tree

5 files changed

+111
-3
lines changed

5 files changed

+111
-3
lines changed

.github/workflows/build-release.yml

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,70 @@
1-
name: Build-Release
1+
name: Build-Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "tag: git tag you want create. (sample 1.0.0)"
8+
required: true
9+
dry-run:
10+
description: "dry-run: true will never create release/nuget."
11+
required: true
12+
default: "false"
13+
14+
env:
15+
GIT_TAG: ${{ github.event.inputs.tag }}
16+
DRY_RUN: ${{ github.event.inputs.dry-run }}
17+
18+
jobs:
19+
build-dotnet:
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 10
22+
steps:
23+
- uses: actions/checkout@v3
24+
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
25+
with:
26+
dotnet-version: '7.0' # require 7.0-rc
27+
include-prerelease: 'true'
28+
# pack nuget
29+
- run: dotnet build -c Release -p:Version=${{ env.GIT_TAG }}
30+
- run: dotnet test -c Release --no-build
31+
- run: dotnet pack -c Release --no-build -p:Version=${{ env.GIT_TAG }} -o ./publish
32+
- uses: actions/upload-artifact@v2
33+
with:
34+
name: nuget
35+
path: ./publish
36+
37+
create-release:
38+
if: github.event.inputs.dry-run == 'false'
39+
needs: [build-dotnet]
40+
runs-on: ubuntu-latest
41+
timeout-minutes: 10
42+
steps:
43+
# tag
44+
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
45+
with:
46+
dotnet-version: '7.0' # require 7.0-rc
47+
include-prerelease: 'true'
48+
- uses: actions/checkout@v3
49+
- name: tag
50+
run: git tag ${{ env.GIT_TAG }}
51+
- name: Push changes
52+
uses: ad-m/github-push-action@master
53+
with:
54+
github_token: ${{ secrets.GITHUB_TOKEN }}
55+
branch: ${{ github.ref }}
56+
tags: true
57+
# Create Releases
58+
- uses: actions/create-release@v1
59+
id: create_release
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
with:
63+
tag_name: ${{ env.GIT_TAG }}
64+
release_name: Ver.${{ env.GIT_TAG }}
65+
draft: true
66+
prerelease: false
67+
# Download (All) Artifacts to current directory
68+
- uses: actions/download-artifact@v2
69+
# Upload to NuGet
70+
- run: dotnet nuget push "./nuget/*.nupkg" -s https://www.nuget.org/api/v2/package -k ${{ secrets.NUGET_KEY }}

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,47 @@
11
# MemoryPack
22
[![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)
33

4-
Ideally fast no encoding binary serializer for .NET.
4+
Zero encoding binary serializer for C#.
55

6+
Currently preview.
67

8+
Installation
9+
---
10+
This library is distributed via NuGet. Minimum requirement is `.NET 7 RC1` and Roslyn Incremental Generator(`4.4.0-1.final`) support.
11+
12+
> PM> Install-Package [MemoryPack](https://www.nuget.org/packages/MemoryPack)
13+
14+
And you need to enable preview features to `.csproj`.
15+
16+
```xml
17+
<EnablePreviewFeatures>True</EnablePreviewFeatures>
18+
```
19+
20+
Quick Start
21+
---
22+
Define the struct or class to be serialized and annotate it with a `[MemoryPackable]` attribute and `partial` keyword.
23+
24+
```csharp
25+
[MemoryPackable]
26+
public partial class MyClass
27+
{
28+
public int MyProperty1 { get; set; }
29+
public int MyProperty2 { get; set; }
30+
}
31+
```
32+
33+
MemoryPack code generator generates `IMemoryPackable<T>` static abstract member.
34+
35+
In Visual Studio, you can check generated code via `Ctrl+K, R` on class name and select `*.MemoryPackFormatter.g.cs`.
736

8-
`<EnablePreviewFeatures>True</EnablePreviewFeatures>`
37+
Call `MemoryPackSerializer.Serialize<T>/Deserialize<T>` to serialize/deserialize your object instance.
938

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

42+
var bin = MemoryPackSerializer.Serialize(v);
43+
var v2 = MemoryPackSerializer.Deserialize<MyClass>(bin);
44+
```
1145

1246
wire format
1347
---

sandbox/Benchmark/Benchmark.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
88
<EnablePreviewFeatures>True</EnablePreviewFeatures>
99
<Nullable>enable</Nullable>
10+
11+
<IsPackable>false</IsPackable>
1012
</PropertyGroup>
1113

1214
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

sandbox/SandboxConsoleApp/SandboxConsoleApp.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<ImplicitUsings>disable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<EnablePreviewFeatures>True</EnablePreviewFeatures>
9+
<IsPackable>false</IsPackable>
910
</PropertyGroup>
1011

1112
<ItemGroup>

src/MemoryPack.Streaming/MemoryPack.Streaming.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<TargetFramework>net6.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7+
<!-- TODO: Currently not publish but will publish... -->
8+
<IsPackable>false</IsPackable>
79
</PropertyGroup>
810

911
<ItemGroup>

0 commit comments

Comments
 (0)