diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4eb53aa..1e05ca1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 diff --git a/src/Directory.Build.props b/src/Directory.Build.props index af4fbed..1051c6d 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,7 +2,7 @@ CryptoFish - 2022 + 2022-2025 Reference implementation for the Zenon SDK for C# zenon, nom, znn, qsr, zts, sdk, dotnet, csharp true @@ -20,11 +20,11 @@ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb ..\..\packages - + all - 3.6.133 + 3.7.115 \ No newline at end of file diff --git a/src/Zenon.Tests/Model/Primitives/HashHeightTest.cs b/src/Zenon.Tests/Model/Primitives/HashHeightTest.cs index c18d604..f8b9e22 100644 --- a/src/Zenon.Tests/Model/Primitives/HashHeightTest.cs +++ b/src/Zenon.Tests/Model/Primitives/HashHeightTest.cs @@ -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 @@ -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) { @@ -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) { diff --git a/src/Zenon.Tests/Zenon.Tests.csproj b/src/Zenon.Tests/Zenon.Tests.csproj index e535480..dce055d 100644 --- a/src/Zenon.Tests/Zenon.Tests.csproj +++ b/src/Zenon.Tests/Zenon.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 disable false Zenon @@ -164,15 +164,15 @@ - - - - - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -182,10 +182,6 @@ - - - - diff --git a/src/Zenon/Wallet/EncryptedFile.cs b/src/Zenon/Wallet/EncryptedFile.cs index 9ba803e..10ce5f7 100644 --- a/src/Zenon/Wallet/EncryptedFile.cs +++ b/src/Zenon/Wallet/EncryptedFile.cs @@ -43,7 +43,7 @@ public byte[] Decrypt(string password) } .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]; @@ -181,7 +181,7 @@ private EncryptedFile EncryptData(byte[] data, string password) // 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. diff --git a/src/Zenon/Zenon.csproj b/src/Zenon/Zenon.csproj index 8e2b723..2533ef0 100644 --- a/src/Zenon/Zenon.csproj +++ b/src/Zenon/Zenon.csproj @@ -1,7 +1,7 @@ - + - net6.0 + net8.0 git icon.png $(AssemblyName).Sdk @@ -21,11 +21,11 @@ - - + + - + @@ -43,8 +43,4 @@ - - - - diff --git a/version.json b/version.json index 68b0bd6..a63ac1a 100644 --- a/version.json +++ b/version.json @@ -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",