Skip to content

Commit

Permalink
Move BCTK LIB code into neo-express (#342)
Browse files Browse the repository at this point in the history
* init

* format

* fix format

* test workflow
  • Loading branch information
Ashuaidehao authored Nov 16, 2023
1 parent 930bfea commit b0bd037
Show file tree
Hide file tree
Showing 105 changed files with 10,994 additions and 112 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Run Test

on:
workflow_call:

env:
CONFIGURATION: 'Release'
DOTNET_VERSION: '7.0.x'

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, macos-12, ubuntu-20.04, ubuntu-22.04, windows-2019, windows-2022]
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install RocksDB Dependencies
if: ${{ runner.os == 'Linux'}}
run: |
sudo apt-get update
sudo apt-get install libsnappy-dev libc6-dev librocksdb-dev -y
- name: Build and Test
run: |
dotnet restore
dotnet build --configuration ${{ env.CONFIGURATION }} --no-restore --verbosity normal --BinaryLogger:./msbuild.${{ matrix.os }}.binlog
dotnet test --configuration ${{ env.CONFIGURATION }} --no-build --verbosity normal --collect:"XPlat Code Coverage"
- name: Upload Coverage
uses: actions/upload-artifact@v3
with:
name: coverage
path: ./test/test.bctklib/TestResults/*/coverage.cobertura.xml
- name: Upload Build Log
uses: actions/upload-artifact@v3
with:
name: buildlog
path: ./msbuild.${{ matrix.os }}.binlog
report:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Coverage Artifact
uses: actions/download-artifact@v3
with:
name: coverage
path: ./coverage
- name: Code Coverage Report
uses: irongut/[email protected]
with:
filename: ./coverage/**/coverage.cobertura.xml
5 changes: 1 addition & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning">
<Version>3.5.119</Version>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" PrivateAssets="all" />
</ItemGroup>
</Project>
16 changes: 16 additions & 0 deletions neo-express.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{CEC93D42
src\Directory.Build.props = src\Directory.Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bctklib", "src\bctklib\bctklib.csproj", "{7DEC97E1-E473-4BFA-8607-044CF496C253}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{24ECF210-FA12-4121-98DA-A18BE75219C6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "test.bctklib", "test\test.bctklib\test.bctklib.csproj", "{2E0DB8B8-F8C2-4DE7-94B3-C796CA807833}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -34,6 +40,14 @@ Global
{32D83A19-F910-42F6-9DEC-73902DE7B92A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{32D83A19-F910-42F6-9DEC-73902DE7B92A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{32D83A19-F910-42F6-9DEC-73902DE7B92A}.Release|Any CPU.Build.0 = Release|Any CPU
{7DEC97E1-E473-4BFA-8607-044CF496C253}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7DEC97E1-E473-4BFA-8607-044CF496C253}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DEC97E1-E473-4BFA-8607-044CF496C253}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DEC97E1-E473-4BFA-8607-044CF496C253}.Release|Any CPU.Build.0 = Release|Any CPU
{2E0DB8B8-F8C2-4DE7-94B3-C796CA807833}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E0DB8B8-F8C2-4DE7-94B3-C796CA807833}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E0DB8B8-F8C2-4DE7-94B3-C796CA807833}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E0DB8B8-F8C2-4DE7-94B3-C796CA807833}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -42,6 +56,8 @@ Global
{986BE47B-F7EF-4FE1-A0BF-42D81D9FBC59} = {BCED0811-9E4F-4034-B297-D21311F81F98}
{C6E71FEE-8BE0-42AF-AE03-C4523F2C1213} = {BCED0811-9E4F-4034-B297-D21311F81F98}
{32D83A19-F910-42F6-9DEC-73902DE7B92A} = {BCED0811-9E4F-4034-B297-D21311F81F98}
{7DEC97E1-E473-4BFA-8607-044CF496C253} = {BCED0811-9E4F-4034-B297-D21311F81F98}
{2E0DB8B8-F8C2-4DE7-94B3-C796CA807833} = {24ECF210-FA12-4121-98DA-A18BE75219C6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {14A0ACFA-EDC0-48D6-9C28-1EBCC3D544A5}
Expand Down
68 changes: 24 additions & 44 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,46 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Authors>ngd enterprise</Authors>
<Company>The Neo Project</Company>
<Copyright>2015-2021 The Neo Project</Copyright>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10</LangVersion>
<Nullable>enable</Nullable>
<PackageIcon>neo-logo-72.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/neo-project/neo-express</PackageProjectUrl>
<PackageTags>Neo;Blockchain;Smart Contract</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/neo-project/neo-express.git</RepositoryUrl>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<BlockchainToolkitLibraryVersion>3.6.19</BlockchainToolkitLibraryVersion>
<!-- <BlockchainToolkitLibraryVersion>local</BlockchainToolkitLibraryVersion> -->
<BlockchainToolkitLibraryLocalPath>..\..\..\lib-bctk</BlockchainToolkitLibraryLocalPath>
<NeoVersion>3.6.0</NeoVersion>
<NeoMonorepoPath>..\..\..\..\official\3neo-monorepo</NeoMonorepoPath>
</PropertyGroup>
<ItemGroup>
<None Include="../neo-logo-72.png" Pack="true" Visible="false" PackagePath=""/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="4.0.1"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
</ItemGroup>
<Choose>
<When Condition=" '$(BlockchainToolkitLibraryVersion)' == 'local'">
<ItemGroup>
<ProjectReference Include="$(BlockchainToolkitLibraryLocalPath)\src\bctklib\bctklib.csproj" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<PackageReference Include="Neo.BlockchainToolkit.Library" Version="$(BlockchainToolkitLibraryVersion)" />
</ItemGroup>
</Otherwise>
</Choose>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
</Project>
<PropertyGroup>
<Authors>ngd enterprise</Authors>
<Company>The Neo Project</Company>
<Copyright>2015-2023 The Neo Project</Copyright>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10</LangVersion>
<Nullable>enable</Nullable>
<PackageIcon>neo-logo-72.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/neo-project/neo-express</PackageProjectUrl>
<PackageTags>Neo;Blockchain;Smart Contract</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/neo-project/neo-express.git</RepositoryUrl>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<NeoVersion>3.6.0</NeoVersion>
</PropertyGroup>
<ItemGroup>
<None Include="../neo-logo-72.png" Pack="true" Visible="false" PackagePath=""/>
</ItemGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
</Project>
40 changes: 40 additions & 0 deletions src/bctklib/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (C) 2015-2023 The Neo Project.
//
// Constants.cs file belongs to neo-express project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

namespace Neo.BlockchainToolkit
{
public static class Constants
{
public const string EXPRESS_EXTENSION = ".neo-express";
public const string DEFAULT_EXPRESS_FILENAME = "default" + EXPRESS_EXTENSION;
public const string WORKNET_EXTENSION = ".neo-worknet";
public const string DEFAULT_WORKNET_FILENAME = "default" + WORKNET_EXTENSION;


public static readonly IReadOnlyList<string> MAINNET_RPC_ENDPOINTS = new[]
{
"http://seed1.neo.org:10332",
"http://seed2.neo.org:10332",
"http://seed3.neo.org:10332",
"http://seed4.neo.org:10332",
"http://seed5.neo.org:10332"
};

public static readonly IReadOnlyList<string> TESTNET_RPC_ENDPOINTS = new[]
{
"http://seed1t5.neo.org:20332",
"http://seed2t5.neo.org:20332",
"http://seed3t5.neo.org:20332",
"http://seed4t5.neo.org:20332",
"http://seed5t5.neo.org:20332"
};
}
}
Loading

0 comments on commit b0bd037

Please sign in to comment.