Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 39 additions & 28 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,46 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
buildConfiguration: Release

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Setup Nerdbank.GitVersioning
uses: dotnet/nbgv@v0.4.0
with:
setAllVars: true
- name: Restore
run: dotnet restore src/Zenon.Sdk.sln
- name: Build
run: dotnet build src/Zenon.Sdk.sln --no-restore
- name: Test
run: dotnet test src/Zenon.Sdk.sln --no-build --verbosity normal --collect:"XPlat Code Coverage"
- name: Pack
run: dotnet pack src/Zenon.Sdk.sln
- name: Publish
run: dotnet nuget push packages/*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json
- name: Codecov
uses: codecov/codecov-action@v3.1.0
with:
directory: src/Zenon.Tests/TestResults
flags: unittests
verbose: true
- uses: actions/checkout@v5
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

- name: Setup dotnet
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x

- name: Setup Nerdbank.GitVersioning
uses: dotnet/nbgv@v0.4.2
with:
setAllVars: true

- name: Restore
run: dotnet restore src/Zenon.Sdk.sln

- name: Build
run: dotnet build src/Zenon.Sdk.sln -c ${{ env.buildConfiguration }} --no-restore

- name: Test
run: dotnet test src/Zenon.Sdk.sln -c ${{ env.buildConfiguration }} --no-build --verbosity normal --collect:"XPlat Code Coverage"

- name: Pack
run: dotnet pack src/Zenon.Sdk.sln -c ${{ env.buildConfiguration }} -o packages

- name: Publish to NuGet
run: dotnet nuget push "packages/*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5.5.1
with:
files: src/Zenon.Tests/TestResults/**/coverage.cobertura.xml
flags: unittests
verbose: true
6 changes: 3 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Authors>CryptoFish</Authors>
<Copyright>2022</Copyright>
<Copyright>2022-2025</Copyright>
<Description>Reference implementation for the Zenon SDK for C#</Description>
<PackageTags>zenon, nom, znn, qsr, zts, sdk, dotnet, csharp</PackageTags>
<IncludeSymbols>true</IncludeSymbols>
Expand All @@ -20,11 +20,11 @@
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<PackageOutputPath>..\..\packages</PackageOutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
<PrivateAssets>all</PrivateAssets>
<Version>3.6.133</Version>
<Version>3.7.115</Version>
</PackageReference>
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions src/Zenon.Tests/Model/Primitives/HashHeightTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Zenon.Model.Primitives
public class HashHeightTest
{
[Theory]
[InlineData("b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b9", 259, "b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b90000000000000103")]
[InlineData("b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b9", 259L, "b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b90000000000000103")]
public void When_GetBytes_ExpectToEqual(string hashString, long? height, string byteString)
{
// Setup
Expand All @@ -23,7 +23,7 @@ public void When_GetBytes_ExpectToEqual(string hashString, long? height, string
}

[Theory]
[InlineData("b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b9", 259, "{\"hash\":\"b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b9\",\"height\":259}")]
[InlineData("b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b9", 259L, "{\"hash\":\"b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b9\",\"height\":259}")]
[InlineData("b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b9", null, "{\"hash\":\"b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b9\",\"height\":null}")]
public void When_Serialize_ExpectToEqual(string hashString, long? height, string expectedJson)
{
Expand All @@ -38,7 +38,7 @@ public void When_Serialize_ExpectToEqual(string hashString, long? height, string
}

[Theory]
[InlineData("b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b9", 259, "{\"hash\":\"b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b9\",\"height\":259}")]
[InlineData("b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b9", 259L, "{\"hash\":\"b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b9\",\"height\":259}")]
[InlineData("b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b9", null, "{\"hash\":\"b3a023d751681b6aed507f7f7c4fa8a59dbee7ee11b3d3e39c294fc078d9b7b9\",\"height\":null}")]
public void When_Deserialize_ExpectToEqual(string hashString, long? height, string json)
{
Expand Down
18 changes: 7 additions & 11 deletions src/Zenon.Tests/Zenon.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>disable</Nullable>
<IsPackable>false</IsPackable>
<RootNamespace>Zenon</RootNamespace>
Expand Down Expand Up @@ -164,15 +164,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="Moq" Version="4.18.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="FluentAssertions" Version="8.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="coverlet.collector" Version="6.0.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand All @@ -182,10 +182,6 @@
<ProjectReference Include="..\Zenon\Zenon.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Nerdbank.GitVersioning" Version="3.5.107" />
</ItemGroup>

<ItemGroup>
<Folder Include="Resources\model\" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Zenon/Wallet/EncryptedFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}
.GetBytes(32); // Using AES-256-GCM, you’ll need a key 256-bits (32-bytes) in length.

using (var aes = new AesGcm(key))
using (var aes = new AesGcm(key, AesGcm.TagByteSizes.MaxSize))
{
var data = new byte[this.Crypto.CipherData.Length - 16];

Expand Down Expand Up @@ -181,7 +181,7 @@
// On Windows and Linux, this API will call into the
// OS implementations of AES, while macOS will require you to
// have OpenSSL installed.
using (var aes = new AesGcm(key))
using (var aes = new AesGcm(key, AesGcm.TagByteSizes.MaxSize))
{
// To encrypt, you’ll first need to generate a nonce: a number used once.
// This must be a cryptographically random value unique to this operation.
Expand Down Expand Up @@ -222,7 +222,7 @@

public override string ToString()
{
return JsonConvert.SerializeObject(JEncryptedFile.ToJObject(this.ToJson()), Formatting.Indented);

Check warning on line 225 in src/Zenon/Wallet/EncryptedFile.cs

View workflow job for this annotation

GitHub Actions / build

Using member 'Newtonsoft.Json.JsonConvert.SerializeObject(Object, Formatting)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Newtonsoft.Json relies on reflection over types that may be removed when trimming.
}
}
}
14 changes: 5 additions & 9 deletions src/Zenon/Zenon.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RepositoryType>git</RepositoryType>
<PackageIcon>icon.png</PackageIcon>
<PackageId>$(AssemblyName).Sdk</PackageId>
Expand All @@ -21,11 +21,11 @@

<ItemGroup>
<PackageReference Include="Chaos.NaCl.Standard" Version="1.0.0" />
<PackageReference Include="Konscious.Security.Cryptography.Argon2" Version="1.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Konscious.Security.Cryptography.Argon2" Version="1.3.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="P3.Ed25519.HdKey" Version="1.0.3" />
<PackageReference Include="SHA3.Net" Version="2.0.0" />
<PackageReference Include="StreamJsonRpc" Version="2.17.8" />
<PackageReference Include="StreamJsonRpc" Version="2.22.11" />
</ItemGroup>

<ItemGroup>
Expand All @@ -43,8 +43,4 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<PackageReference Update="Nerdbank.GitVersioning" Version="3.6.133" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "0.6",
"version": "0.7",
"release": {
"branchName": "release/v{version}",
"versionIncrement": "minor",
Expand Down
Loading