2020-12-21 11:45:07 +00:00
|
|
|
mode = ScriptMode.Verbose
|
|
|
|
|
|
|
|
packageName = "metrics"
|
|
|
|
version = "0.0.1"
|
|
|
|
author = "Status Research & Development GmbH"
|
|
|
|
description = "Metrics client library supporting Prometheus"
|
|
|
|
license = "MIT or Apache License 2.0"
|
|
|
|
skipDirs = @["tests", "benchmarks"]
|
|
|
|
|
|
|
|
### Dependencies
|
2021-06-09 14:59:52 +00:00
|
|
|
requires "nim >= 1.2.0",
|
|
|
|
"chronos >= 2.6.0"
|
2020-12-21 11:45:07 +00:00
|
|
|
|
|
|
|
### Helper functions
|
2022-01-14 09:51:22 +00:00
|
|
|
proc buildBinary(name: string, srcDir = "./", params = "") =
|
2020-12-21 11:45:07 +00:00
|
|
|
if not dirExists "build":
|
|
|
|
mkDir "build"
|
|
|
|
var extra_params = params
|
|
|
|
if paramStr(1) != "e":
|
|
|
|
# we're under Nim, not Nimble
|
|
|
|
for i in 2..<paramCount():
|
|
|
|
extra_params &= " " & paramStr(i)
|
2022-01-14 09:51:22 +00:00
|
|
|
exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") & " --out:./build/" & name & " -f --skipParentCfg --hints:off " & extra_params & " " & srcDir & name & ".nim"
|
2020-12-21 11:45:07 +00:00
|
|
|
|
|
|
|
### tasks
|
|
|
|
task test, "Main tests":
|
|
|
|
# build it with metrics disabled, first
|
|
|
|
buildBinary "main_tests", "tests/"
|
|
|
|
buildBinary "main_tests", "tests/", "--threads:on"
|
2021-06-09 14:59:52 +00:00
|
|
|
buildBinary "main_tests", "tests/", "-r -d:metrics --threads:on"
|
2020-12-21 11:45:07 +00:00
|
|
|
buildBinary "bench_collectors", "benchmarks/"
|
2021-06-09 14:59:52 +00:00
|
|
|
buildBinary "bench_collectors", "benchmarks/", "-r -d:metrics --threads:on"
|
|
|
|
buildBinary "stdlib_server_tests", "tests/", "-r"
|
|
|
|
buildBinary "stdlib_server_tests", "tests/", "-r -d:metrics --threads:on"
|
|
|
|
buildBinary "chronos_server_tests", "tests/", "-r"
|
|
|
|
buildBinary "chronos_server_tests", "tests/", "-r -d:metrics --threads:on"
|
2020-12-21 11:45:07 +00:00
|
|
|
|
|
|
|
task test_chronicles, "Chronicles tests":
|
|
|
|
buildBinary "chronicles_tests", "tests/"
|
2021-06-09 14:59:52 +00:00
|
|
|
buildBinary "chronicles_tests", "tests/", "-r -d:metrics --threads:on"
|
2020-12-21 11:45:07 +00:00
|
|
|
|
|
|
|
task benchmark, "Run benchmarks":
|
2021-06-09 14:59:52 +00:00
|
|
|
buildBinary "bench_collectors", "benchmarks/", "-r -d:metrics --threads:on -d:release"
|
2020-12-21 11:45:07 +00:00
|
|
|
|