Skip to content

Commit

Permalink
Merge branch 'master' into standalone-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim8y authored Feb 26, 2024
2 parents 7ceed88 + 6f230f4 commit 1ff74c7
Show file tree
Hide file tree
Showing 154 changed files with 12,764 additions and 3,377 deletions.
15 changes: 15 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
{
"name": "C# (.NET)",
"image": "mcr.microsoft.com/devcontainers/dotnet:1-7.0-jammy",
"onCreateCommand": "./scripts/load_submodule.sh",
"postCreateCommand": "dotnet restore && dotnet build",
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.csdevkit"
]
}
}
}
16 changes: 16 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
changelog:
exclude:
labels:
- ignore-for-release
authors:
- octocat
categories:
- title: Breaking Changes 🛠
labels:
- breaking-change
- title: Exciting New Features 🎉
labels:
- enhancement
- title: What's Changed
labels:
- "*"
113 changes: 74 additions & 39 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,59 +22,66 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Build
run: dotnet build ./neo-devpack-dotnet.sln
- name: Check format
run: |
dotnet format --no-restore --verify-no-changes --verbosity diagnostic
- name: Build Neo.Compiler.CSharp
run: dotnet build ./src/Neo.Compiler.CSharp/Neo.Compiler.CSharp.csproj
- name: Build Neo.SmartContract.Template and generate artifacts
run: |
dotnet pack ./src/Neo.SmartContract.Template/Neo.SmartContract.Template.csproj
dotnet new install ./src/Neo.SmartContract.Template/bin/Debug/Neo.SmartContract.Template.*.nupkg
dotnet new neocontractnep17 -n Nep17Contract -o ./src/Neo.SmartContract.Template/bin/Debug/nep17/ --force
dotnet new neocontractowner -n Ownable -o ./src/Neo.SmartContract.Template/bin/Debug/ownable/ --force
dotnet new neocontractoracle -n OracleRequest -o ./src/Neo.SmartContract.Template/bin/Debug/oracle/ --force
dotnet new uninstall Neo.SmartContract.Template
dotnet remove ./src/Neo.SmartContract.Template/bin/Debug/nep17/Nep17Contract.csproj package Neo.SmartContract.Framework
dotnet add ./src/Neo.SmartContract.Template/bin/Debug/nep17/Nep17Contract.csproj reference ./src/Neo.SmartContract.Framework/Neo.SmartContract.Framework.csproj
dotnet remove ./src/Neo.SmartContract.Template/bin/Debug/ownable/Ownable.csproj package Neo.SmartContract.Framework
dotnet add ./src/Neo.SmartContract.Template/bin/Debug/ownable/Ownable.csproj reference ./src/Neo.SmartContract.Framework/Neo.SmartContract.Framework.csproj
dotnet remove ./src/Neo.SmartContract.Template/bin/Debug/oracle/OracleRequest.csproj package Neo.SmartContract.Framework
dotnet add ./src/Neo.SmartContract.Template/bin/Debug/oracle/OracleRequest.csproj reference ./src/Neo.SmartContract.Framework/Neo.SmartContract.Framework.csproj
dotnet ./src/Neo.Compiler.CSharp/bin/Debug/net7.0/nccs.dll ./src/Neo.SmartContract.Template/bin/Debug/nep17/Nep17Contract.csproj -o ./tests/Neo.SmartContract.Template.UnitTests/templates/neocontractnep17/Artifacts/ --generate-artifacts source --debug
dotnet ./src/Neo.Compiler.CSharp/bin/Debug/net7.0/nccs.dll ./src/Neo.SmartContract.Template/bin/Debug/ownable/Ownable.csproj -o ./tests/Neo.SmartContract.Template.UnitTests/templates/neocontractowner/Artifacts/ --generate-artifacts source --debug
dotnet ./src/Neo.Compiler.CSharp/bin/Debug/net7.0/nccs.dll ./src/Neo.SmartContract.Template/bin/Debug/oracle/OracleRequest.csproj -o ./tests/Neo.SmartContract.Template.UnitTests/templates/neocontractoracle/Artifacts/ --generate-artifacts source --debug
- name: Build Solution
run: dotnet build ./neo-devpack-dotnet.sln
- name: Add package coverlet.msbuild
run: find tests -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild
- name: Test Neo.Compiler.CSharp.UnitTests
run: |
dotnet test ./tests/Neo.Compiler.CSharp.UnitTests \
--no-build \
-p:CollectCoverage=true \
-p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/
-p:CoverletOutput=${GITHUB_WORKSPACE}/coverage-join/ \
-p:Exclude=\"[Neo.SmartContract.TestEngine]*,[Neo.Compiler.CSharp.UnitTests]*,[Neo]*,[Neo.IO]*,[Neo.Json]*,[Neo.VM]*,[Neo.Extensions]*,[Neo.Cryptography.BLS12_381]*\"
- name: Test Neo.SmartContract.Framework.UnitTests
run: |
dotnet test ./tests/Neo.SmartContract.Framework.UnitTests \
--no-build \
-l "console;verbosity=normal" \
-p:CollectCoverage=true \
-p:CoverletOutput=${GITHUB_WORKSPACE}/coverage-join/ \
-p:MergeWith=${GITHUB_WORKSPACE}/coverage-join/coverage.json \
-p:Exclude=\"[Neo.SmartContract.TestEngine]*,[Neo.Compiler.CSharp.UnitTests]*,[Neo]*,[Neo.IO]*,[Neo.Json]*,[Neo.VM]*,[Neo.Extensions]*,[Neo.Cryptography.BLS12_381]*\"
- name: Test Neo.SmartContract.Template.UnitTests
run: |
dotnet test ./tests/Neo.SmartContract.Template.UnitTests \
--no-build \
-l "console;verbosity=detailed" \
-p:CollectCoverage=true \
-p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/lcov \
-p:MergeWith=${GITHUB_WORKSPACE}/coverage/coverage.json \
-p:Exclude=\"[Neo.Compiler.CSharp.UnitTests]*\" \
-p:MergeWith=${GITHUB_WORKSPACE}/coverage-join/coverage.json \
-p:Exclude=\"[Neo.SmartContract.TestEngine]*,[Neo.Compiler.CSharp.UnitTests]*,[Neo]*,[Neo.IO]*,[Neo.Json]*,[Neo.VM]*,[Neo.Extensions]*,[Neo.Cryptography.BLS12_381]*\" \
-p:CoverletOutputFormat=lcov
- name: Coveralls
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v2.2.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
format: lcov
file: ${GITHUB_WORKSPACE}/coverage/lcov.info

PublishGithub:
# Because sometimes this action is not working as expected we will disable it until determine that it's more stable
if: false && github.ref == 'refs/heads/master' && startsWith(github.repository, 'neo-project/')
needs: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup NuGet.exe for use with actions
uses: NuGet/setup-nuget@v1
with:
nuget-version: latest
- name: Pack with dotnet
run: git rev-list --count HEAD | xargs printf "CI%05d" | xargs dotnet pack src/Neo.SmartContract.Framework -c Debug -o out --include-source --version-suffix
- name: Publish to Github Packages
run: |
nuget source Add -Name "GitHub" -Source "https://nuget.pkg.github.com/neo-project/index.json" -UserName neo-project -Password "${{ secrets.GITHUB_TOKEN }}"
nuget push out/*.nupkg -Source "GitHub"
PublishMyGet:
PublishPackage:
if: github.ref == 'refs/heads/master' && startsWith(github.repository, 'neo-project/')
needs: Test
runs-on: ubuntu-latest
Expand All @@ -83,29 +90,56 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Set Version

- name: Set Version (dev-pack)
run: git rev-list --count HEAD | xargs printf 'CI%05d' | xargs -I{} echo 'VERSION_SUFFIX={}' >> $GITHUB_ENV
- name: Pack Package(s)
- name: Set Version (Neo)
run: |
git --git-dir=./neo/.git rev-list --count HEAD | xargs printf 'CI%05d' | xargs -I{} echo 'VERSION_SUFFIX_NEO={}' >> $GITHUB_ENV
sed -n 's/.*<VersionPrefix>\(.*\)<\/VersionPrefix>.*/\1/p' ./neo/src/Directory.Build.props | xargs -I{} echo 'VERSION_NEO={}' >> $GITHUB_ENV
- name : Pack (Neo.SmartContract.Framework)
run: |
dotnet pack ./src/Neo.SmartContract.Framework \
--configuration Debug \
--output ./out \
--version-suffix ${{ env.VERSION_SUFFIX }}
- name: Publish to MyGet
- name : Replace Neo reference by package in Neo.SmartContract.Testing
run: |
dotnet remove ./src/Neo.SmartContract.Testing/Neo.SmartContract.Testing.csproj reference '..\..\neo\src\Neo\Neo.csproj'
dotnet add ./src/Neo.SmartContract.Testing/Neo.SmartContract.Testing.csproj package 'Neo' --version ${{ env.VERSION_NEO }}-${{ env.VERSION_SUFFIX_NEO }}
- name : Build (Neo.SmartContract.Testing)
run: |
dotnet build ./src/Neo.SmartContract.Testing -f net7.0
dotnet build ./src/Neo.SmartContract.Testing -f netstandard2.1
- name : Pack (Neo.SmartContract.Testing)
run: |
dotnet pack ./src/Neo.SmartContract.Testing \
--no-build \
--configuration Debug \
--output ./out \
--version-suffix ${{ env.VERSION_SUFFIX }}
- name: Publish to Github Packages
working-directory: ./out
run: |
for filename in *.nupkg; do
dotnet nuget push "${filename}" \
dotnet nuget push * \
--source https://nuget.pkg.github.com/neo-project/index.json \
--api-key "${{ secrets.GITHUB_TOKEN }}" \
--disable-buffering \
--no-service-endpoint;
- name: Publish to myGet
working-directory: ./out
run: |
dotnet nuget push * \
--source https://www.myget.org/F/neo/api/v3/index.json \
--api-key "${{ secrets.MYGET_TOKEN }}" \
--disable-buffering \
--no-service-endpoint;
done;
shell: bash
Release:
if: github.ref == 'refs/heads/master' && startsWith(github.repository, 'neo-project/')
Expand All @@ -116,6 +150,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Get version
id: get_version
run: |
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/pkgs-delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Package Cleanup

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

jobs:

delete-myget-pkgs:
name: Delete Old MyGet Packages
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Requests
run: pip install requests
- name: Install Packaging
run: pip install packaging
- name: Delete versions below 3.6.1
env:
MYGET_FEED: 'neo'
PACKAGE_NAMES: 'Neo.SmartContract.Framework,Neo.SmartContract.Testing'
MYGET_API_KEY: ${{ secrets.MYGET_TOKEN }}
run: |
import requests
from packaging import version
import os
def get_versions(feed, package_name, api_key):
url = f"https://www.myget.org/F/{feed}/api/v2/Packages?$select=Version&$filter=Id eq '{package_name}'&$format=json"
headers = {'Accept': 'application/json'}
response = requests.get(url, headers=headers)
if response.status_code == 200:
versions = response.json()['d']['results']
return [ver['Version'] for ver in versions]
else:
return []
def delete_version(feed, package_name, ver, api_key):
url = f"https://www.myget.org/F/{feed}/api/v2/package/{package_name}/{ver}?hardDelete=true"
headers = {"X-NuGet-ApiKey": api_key}
response = requests.delete(url, headers=headers)
return response.status_code == 200 # Success
feed = os.environ['MYGET_FEED']
package_names = os.environ['PACKAGE_NAMES'].split(',')
api_key = os.environ['MYGET_API_KEY']
for package_name in package_names:
versions_to_delete = get_versions(feed, package_name, api_key)
for ver in versions_to_delete:
if version.parse(ver.split("-", 1)[0]) >= version.Version("3.6.1"):
print(f"Omited {ver} of package {package_name}.")
continue
if delete_version(feed, package_name, ver, api_key):
print(f"Deleted version {ver} of package {package_name}.")
else:
print(f"Failed to delete version {ver} of package {package_name}.")
shell: python

delete-git-pkgs:
name: Delete Old Github Packages
runs-on: ubuntu-latest

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

- name: Delete Neo.SmartContract.Framework Package
uses: actions/delete-package-versions@v4
with:
package-name: Neo.SmartContract.Framework
package-type: nuget
min-versions-to-keep: 3
delete-only-pre-release-versions: "true"
token: "${{ secrets.GITHUB_TOKEN }}"
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dotnet.defaultSolution": "neo-devpack-dotnet.sln"
}
2 changes: 1 addition & 1 deletion NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
<add key="MyGet-neo" value="https://www.myget.org/F/neo/api/v3/index.json" />
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
</configuration>
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<p align="center">
<a href="https://neo.org/">
<img
src="https://neo3.azureedge.net/images/logo%20files-dark.svg"
<img src="https://neo3.azureedge.net/images/logo%20files-dark.svg"
width="250px" alt="neo-logo">
</a>
</p>
Expand Down
2 changes: 1 addition & 1 deletion neo
Submodule neo updated 72 files
+73 −41 .github/workflows/main.yml
+128 −0 .github/workflows/pkgs-delete.yml
+2 −0 NuGet.Config
+1 −2 benchmarks/Neo.Benchmarks/Benchmarks.cs
+18 −4 neo.sln
+3 −4 src/Neo.CLI/CLI/MainService.cs
+5 −5 src/Neo.ConsoleService/ConsoleServiceBase.cs
+0 −0 src/Neo.Extensions/LogLevel.cs
+19 −0 src/Neo.Extensions/Neo.Extensions.csproj
+1 −1 src/Neo.Extensions/Utility.cs
+14 −9 src/Neo.IO/ByteArrayComparer.cs
+4 −4 src/Neo.IO/ByteArrayEqualityComparer.cs
+0 −0 src/Neo.IO/ISerializable.cs
+51 −53 src/Neo.IO/MemoryReader.cs
+20 −0 src/Neo.IO/Neo.IO.csproj
+34 −1,442 src/Neo.VM/ExecutionEngine.cs
+65 −0 src/Neo.VM/JumpTable/JumpTable.Bitwisee.cs
+390 −0 src/Neo.VM/JumpTable/JumpTable.Compound.cs
+396 −0 src/Neo.VM/JumpTable/JumpTable.Control.cs
+265 −0 src/Neo.VM/JumpTable/JumpTable.Numeric.cs
+213 −0 src/Neo.VM/JumpTable/JumpTable.Push.cs
+363 −0 src/Neo.VM/JumpTable/JumpTable.Slot.cs
+106 −0 src/Neo.VM/JumpTable/JumpTable.Splice.cs
+124 −0 src/Neo.VM/JumpTable/JumpTable.Stack.cs
+60 −0 src/Neo.VM/JumpTable/JumpTable.Types.cs
+71 −0 src/Neo.VM/JumpTable/JumpTable.cs
+5 −0 src/Neo.VM/Neo.VM.csproj
+5 −0 src/Neo.VM/Types/InteropInterface.cs
+2 −1 src/Neo/Hardfork.cs
+3 −0 src/Neo/Neo.csproj
+21 −6 src/Neo/NeoSystem.cs
+1 −1 src/Neo/Persistence/DataCache.cs
+19 −0 src/Neo/Persistence/MemoryStoreProvider.cs
+19 −10 src/Neo/Persistence/StoreFactory.cs
+47 −5 src/Neo/ProtocolSettings.cs
+1 −1 src/Neo/SmartContract/ApplicationEngine.Contract.cs
+17 −0 src/Neo/SmartContract/ApplicationEngine.OpCodePrices.cs
+93 −51 src/Neo/SmartContract/ApplicationEngine.cs
+6 −6 src/Neo/SmartContract/Helper.cs
+3 −1 src/Neo/SmartContract/IApplicationEngineProvider.cs
+165 −0 src/Neo/SmartContract/Native/ContractEventAttribute.cs
+33 −56 src/Neo/SmartContract/Native/ContractManagement.cs
+10 −0 src/Neo/SmartContract/Native/ContractMethodAttribute.cs
+4 −0 src/Neo/SmartContract/Native/ContractMethodMetadata.cs
+17 −1 src/Neo/SmartContract/Native/CryptoLib.cs
+9 −31 src/Neo/SmartContract/Native/FungibleToken.cs
+7 −3 src/Neo/SmartContract/Native/GasToken.cs
+1 −3 src/Neo/SmartContract/Native/LedgerContract.cs
+139 −32 src/Neo/SmartContract/Native/NativeContract.cs
+21 −64 src/Neo/SmartContract/Native/NeoToken.cs
+15 −56 src/Neo/SmartContract/Native/OracleContract.cs
+8 −7 src/Neo/SmartContract/Native/PolicyContract.cs
+4 −27 src/Neo/SmartContract/Native/RoleManagement.cs
+1 −1 src/Neo/SmartContract/Native/StdLib.cs
+10 −0 src/Neo/SmartContract/StorageItem.cs
+90 −0 src/Neo/Wallets/Helper.cs
+1 −88 src/Neo/Wallets/Wallet.cs
+15 −1 tests/Neo.UnitTests/IO/UT_ByteArrayComparer.cs
+2 −2 tests/Neo.UnitTests/Ledger/UT_MemoryPool.cs
+6 −0 tests/Neo.UnitTests/Persistence/UT_MemoryStore.cs
+151 −0 tests/Neo.UnitTests/SmartContract/Native/UT_ContractEventAttribute.cs
+32 −0 tests/Neo.UnitTests/SmartContract/Native/UT_ContractMethodAttribute.cs
+93 −0 tests/Neo.UnitTests/SmartContract/Native/UT_CryptoLib.cs
+21 −0 tests/Neo.UnitTests/SmartContract/Native/UT_NativeContract.cs
+5 −4 tests/Neo.UnitTests/SmartContract/UT_ApplicationEngineProvider.cs
+2 −2 tests/Neo.UnitTests/SmartContract/UT_Contract.cs
+3 −3 tests/Neo.UnitTests/SmartContract/UT_InteropService.cs
+3 −3 tests/Neo.UnitTests/SmartContract/UT_JsonSerializer.cs
+14 −1 tests/Neo.UnitTests/SmartContract/UT_OpCodePrices.cs
+8 −1 tests/Neo.UnitTests/TestBlockchain.cs
+127 −0 tests/Neo.UnitTests/UT_ProtocolSettings.cs
+15 −4 tests/Neo.VM.Tests/Types/TestEngine.cs
Loading

0 comments on commit 1ff74c7

Please sign in to comment.