Skip to content

Commit

Permalink
Merge branch 'master' into latest-plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim8y authored Aug 12, 2024
2 parents eb64efd + 28043cb commit 63fa805
Show file tree
Hide file tree
Showing 298 changed files with 10,175 additions and 2,424 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Publish (docker-image)

on:
release:
types: [published]

env:
DOTNET_VERSION: 8.0.x
DIST_DIR: ./dist

jobs:
neo-cli-build:
runs-on: ubuntu-latest

steps:
- name: Set Application Version (Environment Variable)
run: |
APP_VERSION=$(echo '${{ github.event.release.tag_name }}' | cut -d 'v' -f 2)
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
- name: Checkout (GitHub)
uses: actions/checkout@v4

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

- name: Build (neo-cli)
run: |
dotnet publish ./src/Neo.CLI \
--framework net8.0 \
--configuration Release \
--runtime linux-x64 \
--self-contained true \
--output ${{ env.DIST_DIR }} \
--verbosity normal \
-p:VersionPrefix=${{ env.APP_VERSION }} \
-p:RuntimeIdentifier=linux-x64 \
-p:SelfContained=true \
-p:IncludeNativeLibrariesForSelfExtract=false \
-p:PublishTrimmed=false \
-p:PublishSingleFile=true \
-p:PublishReadyToRun=true \
-p:EnableCompressionInSingleFile=true \
-p:DebugType=embedded \
-p:ServerGarbageCollection=true
- name: Build (LevelDbStore)
run: |
dotnet build ./src/Plugins/LevelDBStore \
--framework net8.0 \
--configuration Release \
--output ${{ env.DIST_DIR }}/Plugins/LevelDBStore \
--verbosity normal \
-p:VersionPrefix=${{ env.APP_VERSION }}
- name: Remove (junk)
run: |
rm -v ${{ env.DIST_DIR }}/Plugins/LevelDBStore/Neo*
rm -v ${{ env.DIST_DIR }}/Plugins/LevelDBStore/*.pdb
rm -v ${{ env.DIST_DIR }}/Plugins/LevelDBStore/*.xml
rm -v ${{ env.DIST_DIR }}/*.xml
- name: Docker Login
run: |
docker login ghcr.io \
--username ${{ github.repository_owner }} \
--password ${{ secrets.GITHUB_TOKEN }}
- name: Docker Build
run: |
docker build . \
--file ./.neo/docker/neo-cli/Dockerfile \
--tag ghcr.io/${{ github.repository_owner }}/neo-cli:latest \
--tag ghcr.io/${{ github.repository_owner }}/neo-cli:${{ env.APP_VERSION }} \
--push
126 changes: 34 additions & 92 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,30 @@ jobs:
- name: Check Format (*.cs)
run: dotnet format --verify-no-changes --verbosity diagnostic

- name: Build (Neo.CLI)
Test-Everything:
needs: [Format]
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Build (Everything)
run: dotnet build

- name: Install dependencies
run: |
dotnet build ./src/Neo.CLI \
--output ./out/Neo.CLI
sudo apt-get install libleveldb-dev expect
find ./bin -name 'config.json' | xargs perl -pi -e 's|LevelDBStore|MemoryStore|g'
- name: Run tests with expect
run: expect ./scripts/Neo.CLI/test-neo-cli.exp

Test:
needs: [Format]
timeout-minutes: 15
Expand All @@ -39,15 +58,19 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Test
if: matrix.os != 'ubuntu-latest'
run: |
dotnet sln neo.sln remove ./tests/Neo.Plugins.Storage.Tests/Neo.Plugins.Storage.Tests.csproj
dotnet test
dotnet build
dotnet test --blame-hang --blame-crash --no-build
- name: Test for coverall
if: matrix.os == 'ubuntu-latest'
run: |
Expand All @@ -58,13 +81,15 @@ jobs:
dotnet test ./tests/Neo.UnitTests --output ./bin/tests/Neo.UnitTests
dotnet test ./tests/Neo.VM.Tests --output ./bin/tests/Neo.VM.Tests
dotnet test ./tests/Neo.Json.UnitTests --output ./bin/tests/Neo.Json.UnitTests
dotnet test ./tests/Neo.Extensions.Tests --output ./bin/tests/Neo.Extensions.Tests
# Plugins
dotnet test ./tests/Neo.Cryptography.MPTTrie.Tests --output ./bin/tests/Neo.Cryptography.MPTTrie.Tests
dotnet test ./tests/Neo.Network.RPC.Tests --output ./bin/tests/Neo.Network.RPC.Tests
dotnet test ./tests/Neo.Plugins.OracleService.Tests --output ./bin/tests/Neo.Plugins.OracleService.Tests
dotnet test ./tests/Neo.Plugins.RpcServer.Tests --output ./bin/tests/Neo.Plugins.RpcServer.Tests
dotnet test ./tests/Neo.Plugins.Storage.Tests --output ./bin/tests/Neo.Plugins.Storage.Tests
dotnet test ./tests/Neo.Plugins.ApplicationLogs.Tests --output ./bin/tests/Neo.Plugins.ApplicationLogs.Tests
- name: Coveralls
if: matrix.os == 'ubuntu-latest'
Expand All @@ -82,6 +107,8 @@ jobs:
${{ github.workspace }}/tests/Neo.Plugins.OracleService.Tests/TestResults/coverage.info
${{ github.workspace }}/tests/Neo.Plugins.RpcServer.Tests/TestResults/coverage.info
${{ github.workspace }}/tests/Neo.Plugins.Storage.Tests/TestResults/coverage.info
${{ github.workspace }}/tests/Neo.Plugins.ApplicationLogs.Tests/TestResults/coverage.info
${{ github.workspace }}/tests/Neo.Extensions.Tests/TestResults/coverage.info

PublishPackage:
if: github.ref == 'refs/heads/master' && startsWith(github.repository, 'neo-project/')
Expand All @@ -101,27 +128,21 @@ jobs:
- name: Set Version
run: git rev-list --count HEAD | xargs printf 'CI%05d' | xargs -I{} echo 'VERSION_SUFFIX={}' >> $GITHUB_ENV

- name : Pack (Neo)
- name : Pack (Everything)
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;
--no-service-endpoint
- name: Publish to myGet
working-directory: ./out
Expand All @@ -130,83 +151,4 @@ jobs:
--source https://www.myget.org/F/neo/api/v3/index.json \
--api-key "${{ secrets.MYGET_TOKEN }}" \
--disable-buffering \
--no-service-endpoint;
Release:
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: Get version
id: get_version
run: |
sudo apt install xmlstarlet
find src -name Directory.Build.props | xargs xmlstarlet sel -N i=http://schemas.microsoft.com/developer/msbuild/2003 -t -v "concat('::set-output name=version::v',//i:VersionPrefix/text())" | xargs echo
- name: Check tag
id: check_tag
run: curl -s -I ${{ format('https://github.com/{0}/releases/tag/{1}', github.repository, steps.get_version.outputs.version) }} | head -n 1 | cut -d$' ' -f2 | xargs printf "::set-output name=statusCode::%s" | xargs echo
- name: Create release
if: steps.check_tag.outputs.statusCode == '404'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.version }}
release_name: ${{ steps.get_version.outputs.version }}
prerelease: ${{ contains(steps.get_version.outputs.version, '-') }}
- name: Setup .NET
if: steps.check_tag.outputs.statusCode == '404'
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name : Pack (Neo)
if: steps.check_tag.outputs.statusCode == '404'
run: |
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: |
dotnet pack ./src/Neo.Json \
--configuration Release \
--output ./out
- name : Pack (Neo.VM)
if: steps.check_tag.outputs.statusCode == '404'
run: |
dotnet pack ./src/Neo.VM \
--configuration Release \
--output ./out
- name : Pack (Neo.ConsoleService)
if: steps.check_tag.outputs.statusCode == '404'
run: |
dotnet pack ./src/Neo.ConsoleService \
--configuration Release \
--output ./out
- name : Pack (Neo.Cryptography.BLS12_381)
if: steps.check_tag.outputs.statusCode == '404'
run: |
dotnet pack ./src/Neo.Cryptography.BLS12_381 \
--configuration Release \
--output ./out
- name: Publish to NuGet
if: steps.check_tag.outputs.statusCode == '404'
run: |
dotnet nuget push out/*.nupkg -s https://api.nuget.org/v3/index.json -k ${NUGET_TOKEN} --skip-duplicate
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
--no-service-endpoint
46 changes: 46 additions & 0 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release (nuget)

# Trigger the workflow on a release event when a new release is published
on:
release:
types: [published]

# Define environment variables
env:
DOTNET_VERSION: 8.0.x
CONFIGURATION: Release

jobs:
nuget-release:
runs-on: ubuntu-latest
steps:
# Step to set the application version from the release tag
- name: Set Application Version (Environment Variable)
run: |
APP_VERSION=$(echo '${{ github.event.release.tag_name }}' | cut -d 'v' -f 2)
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Pack NuGet Packages
run: |
dotnet pack ./neo.sln \
--configuration Release \
--output ./sbin \
--verbosity normal \
-p:VersionPrefix=${{ env.APP_VERSION }}
- name: Publish to NuGet.org
run: |
dotnet nuget push ./sbin/*.nupkg \
--source https://api.nuget.org/v3/index.json \
--api-key ${{ secrets.NUGET_TOKEN }} \
--skip-duplicate
13 changes: 12 additions & 1 deletion .github/workflows/pkgs-delete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,24 @@ jobs:
delete-only-pre-release-versions: "true"
token: "${{ secrets.GITHUB_TOKEN }}"

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

- name: Delete Neo Package (docker)
uses: actions/delete-package-versions@v4
with:
package-name: Neo
package-type: docker
min-versions-to-keep: 1
delete-only-pre-release-versions: "true"
token: "${{ secrets.GITHUB_TOKEN }}"

- name: Delete Neo.ConsoleService Package
uses: actions/delete-package-versions@v4
with:
Expand All @@ -118,6 +128,7 @@ jobs:
min-versions-to-keep: 3
delete-only-pre-release-versions: "true"
token: "${{ secrets.GITHUB_TOKEN }}"

- name: Delete Neo.Extensions Package
uses: actions/delete-package-versions@v4
with:
Expand Down
Loading

0 comments on commit 63fa805

Please sign in to comment.