Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Remove Travis and use Github Actions (#487)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang committed Nov 26, 2019
1 parent 72361dd commit 1dc5c60
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 142 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
@@ -0,0 +1,17 @@
###############################
# Core EditorConfig Options #
###############################

# dotnet-format requires version 3.1.37601
# dotnet tool update -g dotnet-format
# remember to have: git config --global core.autocrlf false #(which is usually default)

root = true

# Every file

[*]
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
end_of_line = lf
30 changes: 30 additions & 0 deletions .github/workflows/dotnetcore.yml
@@ -0,0 +1,30 @@
name: .NET Core Test

on: pull_request

env:
DOTNET_VERSION: 3.0.100

jobs:

Test:
runs-on: ubuntu-latest
steps:
- name: Chectout
uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Check format
run: |
dotnet tool install --tool-path ./ dotnet-format
./dotnet-format --check --dry-run -v diagnostic
- name: Build
run: dotnet publish -o ./out -c Release
- name: Install dependencies
run: sudo apt-get install libleveldb-dev expect
- name: Run tests with expect
run: expect ./.github/workflows/test-neo-cli.expect
- name: Run RPC tests
run: ./.github/workflows/rpc-tests.sh
11 changes: 2 additions & 9 deletions ci/run-tests-in-docker.sh → .github/workflows/rpc-tests.sh
@@ -1,16 +1,9 @@
#!/bin/bash
#
# This script is run inside the Docker container and tests neo-cli
#
set -e

cd /opt/neo-cli

# Run tests with expect
expect /opt/ci/test-neo-cli.expect
set -e

# Start neo-cli in background for additional JSON-RPC tests
screen -dmS node1 bash -c "dotnet neo-cli.dll --rpc"
screen -dmS node1 bash -c "dotnet out/neo-cli.dll --rpc"

# Wait a little bit
sleep 3
Expand Down
Expand Up @@ -5,7 +5,7 @@
set timeout 10

# Start neo-cli
spawn dotnet neo-cli.dll --rpc
spawn dotnet out/neo-cli.dll --rpc

# Expect the main input prompt
expect {
Expand Down
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

31 changes: 0 additions & 31 deletions ci/Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions ci/README.md

This file was deleted.

28 changes: 0 additions & 28 deletions ci/build-and-test.sh

This file was deleted.

90 changes: 45 additions & 45 deletions neo-cli/Shell/MainService.cs
Expand Up @@ -140,9 +140,9 @@ private bool OnBroadcastCommand(string[] args)
private bool OnDeployCommand(string[] args)
{
if (NoWallet()) return true;
byte[] script = LoadDeploymentScript(
/* filePath */ args[1],
/* manifest */ args.Length == 2 ? "" : args[2],
byte[] script = LoadDeploymentScript(
/* filePath */ args[1],
/* manifest */ args.Length == 2 ? "" : args[2],
/* scriptHash */ out var scriptHash);

Transaction tx;
Expand Down Expand Up @@ -220,9 +220,9 @@ private bool OnInvokeCommand(string[] args)

private byte[] LoadDeploymentScript(string nefFilePath, string manifestFilePath, out UInt160 scriptHash)
{
if (string.IsNullOrEmpty(manifestFilePath))
{
manifestFilePath = Path.ChangeExtension(nefFilePath, ".manifest.json");
if (string.IsNullOrEmpty(manifestFilePath))
{
manifestFilePath = Path.ChangeExtension(nefFilePath, ".manifest.json");
}

// Read manifest
Expand Down Expand Up @@ -251,41 +251,41 @@ private byte[] LoadDeploymentScript(string nefFilePath, string manifestFilePath,

// Basic script checks

using (var engine = new ApplicationEngine(TriggerType.Application, null, null, 0, true))
{
var context = engine.LoadScript(file.Script);

while (context.InstructionPointer <= context.Script.Length)
{
// Check bad opcodes

var ci = context.CurrentInstruction;

if (ci == null || !Enum.IsDefined(typeof(OpCode), ci.OpCode))
{
throw new FormatException($"OpCode not found at {context.InstructionPointer}-{((byte)ci.OpCode).ToString("x2")}");
}

switch (ci.OpCode)
{
case OpCode.SYSCALL:
{
// Check bad syscalls (NEO2)

if (!InteropService.SupportedMethods().ContainsKey(ci.TokenU32))
{
throw new FormatException($"Syscall not found {ci.TokenU32.ToString("x2")}. Are you using a NEO2 smartContract?");
}
break;
}
}

context.InstructionPointer += ci.Size;
}
}

// Build script

using (var engine = new ApplicationEngine(TriggerType.Application, null, null, 0, true))
{
var context = engine.LoadScript(file.Script);

while (context.InstructionPointer <= context.Script.Length)
{
// Check bad opcodes

var ci = context.CurrentInstruction;

if (ci == null || !Enum.IsDefined(typeof(OpCode), ci.OpCode))
{
throw new FormatException($"OpCode not found at {context.InstructionPointer}-{((byte)ci.OpCode).ToString("x2")}");
}

switch (ci.OpCode)
{
case OpCode.SYSCALL:
{
// Check bad syscalls (NEO2)

if (!InteropService.SupportedMethods().ContainsKey(ci.TokenU32))
{
throw new FormatException($"Syscall not found {ci.TokenU32.ToString("x2")}. Are you using a NEO2 smartContract?");
}
break;
}
}

context.InstructionPointer += ci.Size;
}
}

// Build script

scriptHash = file.ScriptHash;
using (ScriptBuilder sb = new ScriptBuilder())
{
Expand Down Expand Up @@ -1071,10 +1071,10 @@ private bool OnShowStateCommand(string[] args)
maxLines = Math.Max(maxLines, linesWritten);
while (linesWritten < maxLines)
{
WriteLineWithoutFlicker("", Console.WindowWidth - 1);
maxLines--;
while (linesWritten < maxLines)
{
WriteLineWithoutFlicker("", Console.WindowWidth - 1);
maxLines--;
}
await Task.Delay(500, cancel.Token);
Expand Down

0 comments on commit 1dc5c60

Please sign in to comment.