mirror of
https://github.com/logos-storage/nim-json-rpc.git
synced 2026-01-07 16:13:07 +00:00
normalise nimble, update ci, unittest2 (#158)
This commit is contained in:
parent
4e9cc184ca
commit
c0ecb42613
21
.github/workflows/ci.yml
vendored
21
.github/workflows/ci.yml
vendored
@ -6,6 +6,10 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency: # Cancel stale PR builds (but not push builds)
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
@ -43,10 +47,10 @@ jobs:
|
|||||||
|
|
||||||
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})'
|
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})'
|
||||||
runs-on: ${{ matrix.builder }}
|
runs-on: ${{ matrix.builder }}
|
||||||
continue-on-error: ${{ matrix.branch == 'version-1-6' || matrix.branch == 'devel' }}
|
continue-on-error: ${{ matrix.branch == 'devel' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install build dependencies (Linux i386)
|
- name: Install build dependencies (Linux i386)
|
||||||
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
|
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
|
||||||
@ -68,13 +72,6 @@ jobs:
|
|||||||
chmod 755 external/bin/gcc external/bin/g++
|
chmod 755 external/bin/gcc external/bin/g++
|
||||||
echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH
|
echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: 'Install dependencies (macOS)'
|
|
||||||
if: runner.os == 'macOS' && matrix.branch == 'devel'
|
|
||||||
run: |
|
|
||||||
brew install openssl@1.1
|
|
||||||
ln -s $(brew --prefix)/opt/openssl/lib/libcrypto.1.1.dylib /usr/local/lib/
|
|
||||||
ln -s $(brew --prefix)/opt/openssl/lib/libssl.1.1.dylib /usr/local/lib/
|
|
||||||
|
|
||||||
- name: MSYS2 (Windows i386)
|
- name: MSYS2 (Windows i386)
|
||||||
if: runner.os == 'Windows' && matrix.target.cpu == 'i386'
|
if: runner.os == 'Windows' && matrix.target.cpu == 'i386'
|
||||||
uses: msys2/setup-msys2@v2
|
uses: msys2/setup-msys2@v2
|
||||||
@ -108,7 +105,6 @@ jobs:
|
|||||||
if: >
|
if: >
|
||||||
steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
|
steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
|
||||||
runner.os == 'Windows'
|
runner.os == 'Windows'
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
mkdir -p external
|
mkdir -p external
|
||||||
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip
|
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip
|
||||||
@ -117,9 +113,8 @@ jobs:
|
|||||||
- name: Path to cached dependencies (Windows)
|
- name: Path to cached dependencies (Windows)
|
||||||
if: >
|
if: >
|
||||||
runner.os == 'Windows'
|
runner.os == 'Windows'
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
echo '${{ github.workspace }}'"/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH
|
echo "${{ github.workspace }}/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Derive environment variables
|
- name: Derive environment variables
|
||||||
run: |
|
run: |
|
||||||
@ -149,7 +144,6 @@ jobs:
|
|||||||
echo "MAKE_CMD=${MAKE_CMD}" >> $GITHUB_ENV
|
echo "MAKE_CMD=${MAKE_CMD}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Build Nim and associated tools
|
- name: Build Nim and associated tools
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh
|
curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh
|
||||||
env MAKE="${MAKE_CMD} -j${ncpu}" ARCH_OVERRIDE=${PLATFORM} NIM_COMMIT=${{ matrix.branch }} \
|
env MAKE="${MAKE_CMD} -j${ncpu}" ARCH_OVERRIDE=${PLATFORM} NIM_COMMIT=${{ matrix.branch }} \
|
||||||
@ -158,7 +152,6 @@ jobs:
|
|||||||
echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH
|
echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
nim --version
|
nim --version
|
||||||
nimble --version
|
nimble --version
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
mode = ScriptMode.Verbose
|
||||||
|
|
||||||
packageName = "json_rpc"
|
packageName = "json_rpc"
|
||||||
version = "0.0.2"
|
version = "0.0.2"
|
||||||
author = "Status Research & Development GmbH"
|
author = "Status Research & Development GmbH"
|
||||||
@ -14,7 +16,26 @@ requires "nim >= 1.2.0",
|
|||||||
"httputils",
|
"httputils",
|
||||||
"chronicles",
|
"chronicles",
|
||||||
"websock",
|
"websock",
|
||||||
"json_serialization"
|
"json_serialization",
|
||||||
|
"unittest2"
|
||||||
|
|
||||||
|
let nimc = getEnv("NIMC", "nim") # Which nim compiler to use
|
||||||
|
let lang = getEnv("NIMLANG", "c") # Which backend (c/cpp/js)
|
||||||
|
let flags = getEnv("NIMFLAGS", "") # Extra flags for the compiler
|
||||||
|
let verbose = getEnv("V", "") notin ["", "0"]
|
||||||
|
|
||||||
|
let styleCheckStyle = if (NimMajor, NimMinor) < (1, 6): "hint" else: "error"
|
||||||
|
let cfg =
|
||||||
|
" --styleCheck:usages --styleCheck:" & styleCheckStyle &
|
||||||
|
(if verbose: "" else: " --verbosity:0 --hints:off") &
|
||||||
|
" --skipParentCfg --skipUserCfg --outdir:build --nimcache:build/nimcache -f" &
|
||||||
|
" --threads:on -d:chronicles_log_level=ERROR"
|
||||||
|
|
||||||
|
proc build(args, path: string) =
|
||||||
|
exec nimc & " " & lang & " " & cfg & " " & flags & " " & args & " " & path
|
||||||
|
|
||||||
|
proc run(args, path: string) =
|
||||||
|
build args & " -r", path
|
||||||
|
|
||||||
proc buildBinary(name: string, srcDir = "./", params = "", cmdParams = "") =
|
proc buildBinary(name: string, srcDir = "./", params = "", cmdParams = "") =
|
||||||
if not dirExists "build":
|
if not dirExists "build":
|
||||||
@ -28,5 +49,4 @@ proc buildBinary(name: string, srcDir = "./", params = "", cmdParams = "") =
|
|||||||
" " & cmdParams
|
" " & cmdParams
|
||||||
|
|
||||||
task test, "run tests":
|
task test, "run tests":
|
||||||
buildBinary "all", "tests/",
|
run "", "tests/all"
|
||||||
params = ""
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import
|
import
|
||||||
std/[strutils, tables, uri],
|
std/[tables, uri],
|
||||||
stew/[byteutils, results],
|
stew/[byteutils, results],
|
||||||
chronos/apps/http/httpclient as chronosHttpClient,
|
chronos/apps/http/httpclient as chronosHttpClient,
|
||||||
chronicles, httputils, json_serialization/std/net,
|
chronicles, httputils, json_serialization/std/net,
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import
|
import
|
||||||
stew/byteutils,
|
stew/byteutils,
|
||||||
std/[strutils],
|
|
||||||
chronicles, httputils, chronos,
|
chronicles, httputils, chronos,
|
||||||
chronos/apps/http/[httpserver, shttpserver],
|
chronos/apps/http/[httpserver, shttpserver],
|
||||||
".."/[errors, server]
|
".."/[errors, server]
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import
|
import
|
||||||
chronicles, httputils, chronos, websock/[websock, types],
|
chronicles, chronos, websock/[websock, types],
|
||||||
websock/extensions/compression/deflate,
|
websock/extensions/compression/deflate,
|
||||||
stew/byteutils, json_serialization/std/net,
|
stew/byteutils, json_serialization/std/net,
|
||||||
".."/[errors, server]
|
".."/[server]
|
||||||
|
|
||||||
export server, net
|
export server, net
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import
|
import
|
||||||
unittest, tables,
|
unittest2, tables,
|
||||||
stint, ethtypes, ethprocs, stintjson, chronicles,
|
stint, ethtypes, ethprocs, stintjson, chronicles,
|
||||||
../json_rpc/[rpcclient, rpcserver], ./helpers
|
../json_rpc/[rpcclient, rpcserver], ./helpers
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import
|
import
|
||||||
unittest,
|
unittest2,
|
||||||
websock/websock,
|
websock/websock,
|
||||||
../json_rpc/[rpcclient, rpcserver]
|
../json_rpc/[rpcclient, rpcserver]
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import unittest, strutils
|
import unittest2
|
||||||
import httputils
|
|
||||||
import ../json_rpc/[rpcserver, rpcclient]
|
import ../json_rpc/[rpcserver, rpcclient]
|
||||||
|
|
||||||
const TestsCount = 100
|
const TestsCount = 100
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import unittest, strutils
|
import unittest2, strutils
|
||||||
import httputils
|
import httputils
|
||||||
import ../json_rpc/[rpcsecureserver, rpcclient]
|
import ../json_rpc/[rpcsecureserver, rpcclient]
|
||||||
import chronos/[streams/tlsstream, apps/http/httpcommon]
|
import chronos/[streams/tlsstream, apps/http/httpcommon]
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import
|
import
|
||||||
unittest, chronicles,
|
unittest2, chronicles,
|
||||||
../json_rpc/[rpcclient, rpcserver, rpcproxy]
|
../json_rpc/[rpcclient, rpcserver, rpcproxy]
|
||||||
|
|
||||||
let srvAddress = initTAddress("127.0.0.1", Port(8545))
|
let srvAddress = initTAddress("127.0.0.1", Port(8545))
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import unittest, chronicles, options
|
import unittest2, chronicles, options
|
||||||
import ../json_rpc/rpcserver, ./helpers
|
import ../json_rpc/rpcserver, ./helpers
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import
|
import
|
||||||
unittest, chronicles,
|
unittest2, chronicles,
|
||||||
../json_rpc/[rpcclient, rpcserver]
|
../json_rpc/[rpcclient, rpcserver]
|
||||||
|
|
||||||
# Create RPC on server
|
# Create RPC on server
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user