Skip to content

Native: properly activate native methods/events (#4524) #15754

Native: properly activate native methods/events (#4524)

Native: properly activate native methods/events (#4524) #15754

Workflow file for this run

name: .NET Core Test and Publish
on:
push:
branches: [master-n3]
pull_request:
env:
DOTNET_VERSION: 10.0.x
jobs:
Check-Vulnerable:
name: Scan for Vulnerable Dependencies
timeout-minutes: 15
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore
run: dotnet restore
- name: Scan for Vulnerable Dependencies
run: dotnet list package --vulnerable --include-transitive
Test:
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key : ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Check Format (*.cs)
if: matrix.os == 'ubuntu-latest'
run: dotnet format --verify-no-changes --verbosity diagnostic
- name: Test (ALL OS)
if: matrix.os != 'ubuntu-latest'
run: |
dotnet test -p:GITHUB_ACTIONS=true
- name: Test (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
find tests -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild
dotnet test /p:GITHUB_ACTIONS=true /p:CollectCoverage=true /p:CoverletOutput='${{ github.workspace }}/TestResults/coverage/' /p:MergeWith='${{ github.workspace }}/TestResults/coverage/coverage.json' /p:CoverletOutputFormat=\"lcov,json\" -m:1
- name: Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ github.workspace }}/TestResults/coverage/coverage.info
fail_ci_if_error: false
PublishMyGet:
if: github.ref == 'refs/heads/master-n3' && startsWith(github.repository, 'neo-project/')
needs: [Test]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v5
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 (Everything)
run: dotnet pack -c Debug -o out --include-source --version-suffix ${{ env.VERSION_SUFFIX }}
- name: Publish to myGet
run: dotnet nuget push out/*.nupkg -s https://www.myget.org/F/neo/api/v2/package -k ${MYGET_TOKEN} -ss https://www.myget.org/F/neo/symbols/api/v2/package -sk ${MYGET_TOKEN}
env:
MYGET_TOKEN: ${{ secrets.MYGET_TOKEN }}
Release:
if: github.ref == 'refs/heads/master-n3' && startsWith(github.repository, 'neo-project/')
needs: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- 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('version=v',//i:Version/text())" | xargs echo >> $GITHUB_OUTPUT
- name: Check tag
if: steps.get_version.outputs.version != 'v' && startsWith(steps.get_version.outputs.version, 'v')
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 "statusCode=%s" | xargs echo >> $GITHUB_OUTPUT
- 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 Core
if: steps.check_tag.outputs.statusCode == '404'
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Publish to NuGet
if: steps.check_tag.outputs.statusCode == '404'
run: |
dotnet pack -o out -c Release
dotnet nuget push out/*.nupkg -s https://api.nuget.org/v3/index.json -k ${NUGET_TOKEN}
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}