normalise nimble, update ci, unittest2 (#158)

This commit is contained in:
Jacek Sieka 2022-12-02 13:17:27 +01:00 committed by GitHub
parent 4e9cc184ca
commit c0ecb42613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 40 additions and 29 deletions

View File

@ -6,6 +6,10 @@ on:
pull_request:
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:
build:
strategy:
@ -43,10 +47,10 @@ jobs:
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})'
runs-on: ${{ matrix.builder }}
continue-on-error: ${{ matrix.branch == 'version-1-6' || matrix.branch == 'devel' }}
continue-on-error: ${{ matrix.branch == 'devel' }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install build dependencies (Linux i386)
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
@ -68,13 +72,6 @@ jobs:
chmod 755 external/bin/gcc external/bin/g++
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)
if: runner.os == 'Windows' && matrix.target.cpu == 'i386'
uses: msys2/setup-msys2@v2
@ -108,7 +105,6 @@ jobs:
if: >
steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
runner.os == 'Windows'
shell: bash
run: |
mkdir -p external
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip
@ -117,9 +113,8 @@ jobs:
- name: Path to cached dependencies (Windows)
if: >
runner.os == 'Windows'
shell: bash
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
run: |
@ -149,7 +144,6 @@ jobs:
echo "MAKE_CMD=${MAKE_CMD}" >> $GITHUB_ENV
- name: Build Nim and associated tools
shell: bash
run: |
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 }} \
@ -158,7 +152,6 @@ jobs:
echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH
- name: Run tests
shell: bash
run: |
nim --version
nimble --version

View File

@ -1,3 +1,5 @@
mode = ScriptMode.Verbose
packageName = "json_rpc"
version = "0.0.2"
author = "Status Research & Development GmbH"
@ -14,7 +16,26 @@ requires "nim >= 1.2.0",
"httputils",
"chronicles",
"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 = "") =
if not dirExists "build":
@ -28,5 +49,4 @@ proc buildBinary(name: string, srcDir = "./", params = "", cmdParams = "") =
" " & cmdParams
task test, "run tests":
buildBinary "all", "tests/",
params = ""
run "", "tests/all"

View File

@ -1,5 +1,5 @@
import
std/[strutils, tables, uri],
std/[tables, uri],
stew/[byteutils, results],
chronos/apps/http/httpclient as chronosHttpClient,
chronicles, httputils, json_serialization/std/net,

View File

@ -1,6 +1,5 @@
import
stew/byteutils,
std/[strutils],
chronicles, httputils, chronos,
chronos/apps/http/[httpserver, shttpserver],
".."/[errors, server]

View File

@ -1,8 +1,8 @@
import
chronicles, httputils, chronos, websock/[websock, types],
chronicles, chronos, websock/[websock, types],
websock/extensions/compression/deflate,
stew/byteutils, json_serialization/std/net,
".."/[errors, server]
".."/[server]
export server, net

View File

@ -1,5 +1,5 @@
import
unittest, tables,
unittest2, tables,
stint, ethtypes, ethprocs, stintjson, chronicles,
../json_rpc/[rpcclient, rpcserver], ./helpers

View File

@ -1,5 +1,5 @@
import
unittest,
unittest2,
websock/websock,
../json_rpc/[rpcclient, rpcserver]

View File

@ -1,5 +1,4 @@
import unittest, strutils
import httputils
import unittest2
import ../json_rpc/[rpcserver, rpcclient]
const TestsCount = 100

View File

@ -1,4 +1,4 @@
import unittest, strutils
import unittest2, strutils
import httputils
import ../json_rpc/[rpcsecureserver, rpcclient]
import chronos/[streams/tlsstream, apps/http/httpcommon]

View File

@ -1,5 +1,5 @@
import
unittest, chronicles,
unittest2, chronicles,
../json_rpc/[rpcclient, rpcserver, rpcproxy]
let srvAddress = initTAddress("127.0.0.1", Port(8545))

View File

@ -1,4 +1,4 @@
import unittest, chronicles, options
import unittest2, chronicles, options
import ../json_rpc/rpcserver, ./helpers
type

View File

@ -1,5 +1,5 @@
import
unittest, chronicles,
unittest2, chronicles,
../json_rpc/[rpcclient, rpcserver]
# Create RPC on server