2022-02-24 11:56:11 +00:00
|
|
|
# Package
|
|
|
|
|
|
|
|
version = "0.0.1"
|
|
|
|
author = "Status Research & Development GmbH"
|
|
|
|
description = "DHT based on the libp2p Kademlia spec"
|
|
|
|
license = "MIT"
|
|
|
|
skipDirs = @["tests"]
|
|
|
|
|
|
|
|
|
|
|
|
# Dependencies
|
|
|
|
requires "nim >= 1.2.0",
|
|
|
|
"nimcrypto >= 0.5.4 & < 0.6.0",
|
2023-06-02 22:24:10 +00:00
|
|
|
"bearssl#f4c4233de453cb7eac0ce3f3ffad6496295f83ab",
|
2022-02-24 11:56:11 +00:00
|
|
|
"chronicles >= 0.10.2 & < 0.11.0",
|
|
|
|
"chronos >= 3.0.11 & < 3.1.0",
|
2022-11-02 16:21:05 +00:00
|
|
|
"libp2p#unstable",
|
2022-02-24 11:56:11 +00:00
|
|
|
"metrics",
|
|
|
|
"protobufserialization >= 0.2.0 & < 0.3.0",
|
|
|
|
"secp256k1 >= 0.5.2 & < 0.6.0",
|
|
|
|
"stew#head",
|
|
|
|
"stint",
|
2022-09-29 23:49:55 +00:00
|
|
|
"asynctest >= 0.3.1 & < 0.4.0",
|
|
|
|
"https://github.com/status-im/nim-datastore#head",
|
2023-06-05 13:02:28 +00:00
|
|
|
"questionable",
|
|
|
|
"datastore"
|
2022-02-25 02:39:07 +00:00
|
|
|
|
|
|
|
task coverage, "generates code coverage report":
|
|
|
|
var (output, exitCode) = gorgeEx("which lcov")
|
|
|
|
if exitCode != 0:
|
|
|
|
echo ""
|
|
|
|
echo " ************************** ⛔️ ERROR ⛔️ **************************"
|
|
|
|
echo " ** **"
|
|
|
|
echo " ** ERROR: lcov not found, it must be installed to run code **"
|
|
|
|
echo " ** coverage locally **"
|
|
|
|
echo " ** **"
|
|
|
|
echo " *****************************************************************"
|
|
|
|
echo ""
|
|
|
|
quit 1
|
|
|
|
|
|
|
|
(output, exitCode) = gorgeEx("gcov --version")
|
|
|
|
if output.contains("Apple LLVM"):
|
|
|
|
echo ""
|
|
|
|
echo " ************************* ⚠️ WARNING ⚠️ *************************"
|
|
|
|
echo " ** **"
|
|
|
|
echo " ** WARNING: Using Apple's llvm-cov in place of gcov, which **"
|
|
|
|
echo " ** emulates an old version of gcov (4.2.0) and therefore **"
|
|
|
|
echo " ** coverage results will differ than those on CI (which **"
|
|
|
|
echo " ** uses a much newer version of gcov). **"
|
|
|
|
echo " ** **"
|
|
|
|
echo " *****************************************************************"
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
exec("nimble --verbose test --opt:speed -d:debug --verbosity:0 --hints:off --lineDir:on -d:chronicles_log_level=INFO --nimcache:nimcache --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage")
|
|
|
|
exec("cd nimcache; rm *.c; cd ..")
|
|
|
|
mkDir("coverage")
|
|
|
|
exec("lcov --capture --directory nimcache --output-file coverage/coverage.info")
|
|
|
|
exec("$(which bash) -c 'shopt -s globstar; ls $(pwd)/libp2pdht/{*,**/*}.nim'")
|
|
|
|
exec("$(which bash) -c 'shopt -s globstar; lcov --extract coverage/coverage.info $(pwd)/libp2pdht/{*,**/*}.nim --output-file coverage/coverage.f.info'")
|
|
|
|
echo "Generating HTML coverage report"
|
|
|
|
exec("genhtml coverage/coverage.f.info --output-directory coverage/report")
|
|
|
|
echo "Opening HTML coverage report in browser..."
|
|
|
|
exec("open coverage/report/index.html")
|
2022-11-02 16:21:05 +00:00
|
|
|
|