Skip to content
Merged
27 changes: 23 additions & 4 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

Build-Test-Neo-Cli:
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 (Neo.CLI)
run: |
dotnet build ./src/Neo.CLI \
--output ./out/Neo.CLI

run: dotnet build ./src/Neo.CLI --output ./out/Neo.CLI

- name: Install dependencies
run: |
sudo apt-get install libleveldb-dev expect
find ./out -name 'config.json' | xargs perl -pi -e 's|LevelDBStore|MemoryStore|g'

- name: Run tests with expect
run: expect ./.github/workflows/test-neo-cli.expect

Test:
needs: [Format]
timeout-minutes: 15
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/test-neo-cli.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/usr/bin/expect -f
#
# This script uses expect to test neo-cli
#
set timeout 10


# Start neo-cli
spawn dotnet out/Neo.CLI/neo-cli.dll

# Expect the main input prompt
expect {
"neo> " { }
"error" { exit 2 }
timeout { exit 1 }
}

#
# Test 'create wallet'
#
send "create wallet test-wallet1.json\n"

expect {
"password:" { send "asd\n" }
"error" { exit 2 }
timeout { exit 1 }
}

expect {
"password:" { send "asd\n" }
"error" { exit 2 }
timeout { exit 1 }
}

expect {
" Address:" { }
"error" { exit 2 }
timeout { exit 1 }
}


#
# Test 'create wallet'
#
send "create wallet test-wallet2.json L2ArHTuiDL4FHu4nfyhamrG8XVYB4QyRbmhj7vD6hFMB5iAMSTf6\n"

expect {
"password:" { send "abcd\n" }
"error" { exit 2 }
timeout { exit 1 }
}

expect {
"password:" { send "abcd\n" }
"error" { exit 2 }
timeout { exit 1 }
}

expect {
"NUj249PQg9EMJfAuxKizdJwMG7GSBzYX2Y" { }
"error" { exit 2 }
timeout { exit 1 }
}

#
# Test 'list address'
#
send "list address\n"

expect {
"neo> " { }
"error" { exit 2 }
timeout { exit 1 }
}

#
# Test 'create address'
#
send "create address\n"

expect {
"neo> " { }
"error" { exit 2 }
timeout { exit 1 }
}
exit 0