Skip to content

Commit

Permalink
Merge branch 'master' into core-jumptable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim8y authored Feb 15, 2024
2 parents d445a8d + 6746665 commit 6a395e4
Show file tree
Hide file tree
Showing 19 changed files with 286 additions and 82 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,44 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/lcov.net7.0.info

PublishGithub:
if: github.ref == 'refs/heads/master' && startsWith(github.repository, 'neo-project/')
needs: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Set Version
run: git rev-list --count HEAD | xargs printf 'CI%05d' | xargs -I{} echo 'VERSION_SUFFIX={}' >> $GITHUB_ENV

- name : Pack (Neo)
run: |
dotnet pack \
--configuration Release \
--output ./out \
--version-suffix ${{ env.VERSION_SUFFIX }}
- name: Remove Unwanted Files
working-directory: ./out
run: |
rm -v Neo.CLI*
rm -v Neo.GUI*
- name: Publish to Github Packages
working-directory: ./out
run: |
dotnet nuget push * \
--source https://nuget.pkg.github.com/neo-project/index.json \
--api-key "${{ secrets.GITHUB_TOKEN }}" \
--disable-buffering \
--no-service-endpoint;
# MyGet isn't working
# PublishMyGet:
# if: github.ref == 'refs/heads/master' && startsWith(github.repository, 'neo-project/')
Expand Down Expand Up @@ -113,6 +151,18 @@ jobs:
dotnet pack ./src/Neo \
--configuration Release \
--output ./out
- name : Pack (Neo.IO)
if: steps.check_tag.outputs.statusCode == '404'
run: |
dotnet pack ./src/Neo.IO \
--configuration Release \
--output ./out
- name : Pack (Neo.Extensions)
if: steps.check_tag.outputs.statusCode == '404'
run: |
dotnet pack ./src/Neo.Extensions \
--configuration Release \
--output ./out
- name : Pack (Neo.Json)
if: steps.check_tag.outputs.statusCode == '404'
run: |
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/pkgs-delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Nuget Package Cleanup (github)

on:
schedule:
- cron: '0 0 * * *' # Run every day at 24:00

jobs:
delete-pkgs:
name: Delete Old Nuget Packages
runs-on: ubuntu-latest

steps:
- name: Delete Neo Package
uses: actions/delete-package-versions@v4
with:
package-name: Neo
package-type: nuget
min-versions-to-keep: 3
token: "${{ secrets.GITHUB_TOKEN }}"

- name: Delete Neo.ConsoleService Package
uses: actions/delete-package-versions@v4
with:
package-name: Neo.ConsoleService
package-type: nuget
min-versions-to-keep: 3
token: "${{ secrets.GITHUB_TOKEN }}"

- name: Delete Neo.ConsoleService Package
uses: actions/delete-package-versions@v4
with:
package-name: Neo.ConsoleService
package-type: nuget
min-versions-to-keep: 3
token: "${{ secrets.GITHUB_TOKEN }}"

- name: Delete Neo.Json Package
uses: actions/delete-package-versions@v4
with:
package-name: Neo.Json
package-type: nuget
min-versions-to-keep: 3
token: "${{ secrets.GITHUB_TOKEN }}"

- name: Delete Neo.VM Package
uses: actions/delete-package-versions@v4
with:
package-name: Neo.VM
package-type: nuget
min-versions-to-keep: 3
token: "${{ secrets.GITHUB_TOKEN }}"
1 change: 1 addition & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<configuration>
<packageSources>
<clear />
<add key="github" value="https://nuget.pkg.github.com/neo-project/index.json" />
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
22 changes: 18 additions & 4 deletions neo.sln
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,22 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.VM", "src\Neo.VM\Neo.VM
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.VM.Tests", "tests\Neo.VM.Tests\Neo.VM.Tests.csproj", "{005F84EB-EA2E-449F-930A-7B4173DDC7EC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.ConsoleService", "src\Neo.ConsoleService\Neo.ConsoleService.csproj", "{9E886812-7243-48D8-BEAF-47AADC11C054}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.ConsoleService", "src\Neo.ConsoleService\Neo.ConsoleService.csproj", "{9E886812-7243-48D8-BEAF-47AADC11C054}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.GUI", "src\Neo.GUI\Neo.GUI.csproj", "{02ABDE42-9880-43B4-B6F7-8D618602A277}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.GUI", "src\Neo.GUI\Neo.GUI.csproj", "{02ABDE42-9880-43B4-B6F7-8D618602A277}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.CLI", "src\Neo.CLI\Neo.CLI.csproj", "{BDFBE455-4C1F-4FC4-B5FC-1387B93A8687}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.CLI", "src\Neo.CLI\Neo.CLI.csproj", "{BDFBE455-4C1F-4FC4-B5FC-1387B93A8687}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.ConsoleService.Tests", "tests\Neo.ConsoleService.Tests\Neo.ConsoleService.Tests.csproj", "{B40F8584-5AFB-452C-AEFA-009C80CC23A9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.ConsoleService.Tests", "tests\Neo.ConsoleService.Tests\Neo.ConsoleService.Tests.csproj", "{B40F8584-5AFB-452C-AEFA-009C80CC23A9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Cryptography.BLS12_381", "src\Neo.Cryptography.BLS12_381\Neo.Cryptography.BLS12_381.csproj", "{D48C1FAB-3471-4CA0-8688-25E6F43F2C25}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Cryptography.BLS12_381.Tests", "tests\Neo.Cryptography.BLS12_381.Tests\Neo.Cryptography.BLS12_381.Tests.csproj", "{387CCF6C-9A26-43F6-A639-0A82E91E10D8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.IO", "src\Neo.IO\Neo.IO.csproj", "{4CDAC1AA-45C6-4157-8D8E-199050433048}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.Extensions", "src\Neo.Extensions\Neo.Extensions.csproj", "{9C5213D6-3833-4570-8AE2-47E9F9017A8F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -98,6 +102,14 @@ Global
{387CCF6C-9A26-43F6-A639-0A82E91E10D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{387CCF6C-9A26-43F6-A639-0A82E91E10D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{387CCF6C-9A26-43F6-A639-0A82E91E10D8}.Release|Any CPU.Build.0 = Release|Any CPU
{4CDAC1AA-45C6-4157-8D8E-199050433048}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4CDAC1AA-45C6-4157-8D8E-199050433048}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4CDAC1AA-45C6-4157-8D8E-199050433048}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4CDAC1AA-45C6-4157-8D8E-199050433048}.Release|Any CPU.Build.0 = Release|Any CPU
{9C5213D6-3833-4570-8AE2-47E9F9017A8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C5213D6-3833-4570-8AE2-47E9F9017A8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C5213D6-3833-4570-8AE2-47E9F9017A8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C5213D6-3833-4570-8AE2-47E9F9017A8F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -117,6 +129,8 @@ Global
{B40F8584-5AFB-452C-AEFA-009C80CC23A9} = {EDE05FA8-8E73-4924-BC63-DD117127EEE1}
{D48C1FAB-3471-4CA0-8688-25E6F43F2C25} = {B5339DF7-5D1D-43BA-B332-74B825E1770E}
{387CCF6C-9A26-43F6-A639-0A82E91E10D8} = {EDE05FA8-8E73-4924-BC63-DD117127EEE1}
{4CDAC1AA-45C6-4157-8D8E-199050433048} = {B5339DF7-5D1D-43BA-B332-74B825E1770E}
{9C5213D6-3833-4570-8AE2-47E9F9017A8F} = {B5339DF7-5D1D-43BA-B332-74B825E1770E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BCBA19D9-F868-4C6D-8061-A2B91E06E3EC}
Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions src/Neo.Extensions/Neo.Extensions.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<PackageTags>NEO;Blockchain;Extensions</PackageTags>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Akka" Version="1.5.14" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="Neo" />
<InternalsVisibleTo Include="Neo.IO" />
<InternalsVisibleTo Include="$(AssemblyName).Tests" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Neo/Utility.cs → src/Neo.Extensions/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Logger()
}
}

public static event LogEventHandler Logging;
public static event LogEventHandler? Logging;

/// <summary>
/// A strict UTF8 encoding used in NEO system.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,32 @@ internal class ByteArrayComparer : IComparer<byte[]>
public static readonly ByteArrayComparer Default = new(1);
public static readonly ByteArrayComparer Reverse = new(-1);

private readonly int direction;
private readonly int _direction;

private ByteArrayComparer(int direction)
{
this.direction = direction;
_direction = direction;
}

public int Compare(byte[] x, byte[] y)
public int Compare(byte[]? x, byte[]? y)
{
return direction > 0
? CompareInternal(x, y)
: -CompareInternal(x, y);
if (x == y) return 0;
if (x is null && y is not null)
return _direction > 0 ? -y.Length : y.Length;
if (y is null && x is not null)
return _direction > 0 ? x.Length : -x.Length;
return _direction > 0 ?
CompareInternal(x!, y!) :
-CompareInternal(x!, y!);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int CompareInternal(byte[] x, byte[] y)
{
int length = Math.Min(x.Length, y.Length);
for (int i = 0; i < length; i++)
var length = Math.Min(x.Length, y.Length);
for (var i = 0; i < length; i++)
{
int r = x[i].CompareTo(y[i]);
var r = x[i].CompareTo(y[i]);
if (r != 0) return r;
}
return x.Length.CompareTo(y.Length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ internal class ByteArrayEqualityComparer : IEqualityComparer<byte[]>
{
public static readonly ByteArrayEqualityComparer Default = new();

public unsafe bool Equals(byte[] x, byte[] y)
public unsafe bool Equals(byte[]? x, byte[]? y)
{
if (ReferenceEquals(x, y)) return true;
if (x is null || y is null) return false;
int len = x.Length;
var len = x.Length;
if (len != y.Length) return false;
if (len == 0) return true;
fixed (byte* xp = x, yp = y)
Expand All @@ -48,8 +48,8 @@ public int GetHashCode(byte[] obj)
{
unchecked
{
int hash = 17;
foreach (byte element in obj)
var hash = 17;
foreach (var element in obj)
hash = hash * 31 + element;
return hash;
}
Expand Down
File renamed without changes.
Loading

0 comments on commit 6a395e4

Please sign in to comment.