mirror of
https://github.com/logos-storage/nim-libplum.git
synced 2026-07-24 00:03:11 +00:00
* Tests: Dockerfile: Remove cmake from deps.
* Tests: Dockerfile: Replace manual libplum building with nimble task.
* Build libplum without cmake.
* Use {.compile.} to compile libplum as part of tha package; remove separate build task.
* Rewrite flags construction, pass flags to compile, remove passC.
* Add localPassC.
* Combine libplum units to libplum_units.c.
* Tests: Dockerfile: Add the units file to the image.
* Add missing flags.
* CI: Remove redundant cmake invocations.
* Remove redundant nimble task invocation.
33 lines
1.3 KiB
Nim
33 lines
1.3 KiB
Nim
mode = ScriptMode.Verbose
|
|
|
|
packageName = "libplum"
|
|
version = "0.0.1"
|
|
author = "Status Research & Development GmbH"
|
|
description = "Nim binding for libplum (PCP, NAT-PMP, UPnP-IGD port mapping)"
|
|
license = "Apache License 2.0 or MIT"
|
|
installDirs = @["libplum", "vendor"]
|
|
|
|
### Dependencies
|
|
requires "nim >= 1.6.0",
|
|
"results >= 0.4.0",
|
|
"chronos >= 4.2.0 & < 5.0.0",
|
|
"unittest2"
|
|
|
|
task format, "format Nim code using nph":
|
|
exec "nph libplum/ tests/"
|
|
|
|
task test, "run tests":
|
|
exec("nimble setup")
|
|
exec("nim c -o:tests/test_plum tests/test_plum.nim")
|
|
exec("./tests/test_plum")
|
|
|
|
task testIntegration, "run miniupnpd integration tests in Docker / Podman":
|
|
let docker = if findExe("podman") != "": "podman" else: "docker"
|
|
exec(docker & " build -t " & packageName & " -f tests/Dockerfile .")
|
|
proc envFlag(name: string): string =
|
|
if getEnv(name) != "": " -e " & name & "=" & getEnv(name) else: ""
|
|
let flags = envFlag("TEST_VERBOSE") & envFlag("MINIUPNPD_VERBOSE") & envFlag("LIBPLUM_VERBOSE")
|
|
exec(docker & " run --rm --cap-add=NET_ADMIN -e TEST_MINIUPNP_PCP=1" & flags & " " & packageName)
|
|
exec(docker & " run --rm --cap-add=NET_ADMIN -e TEST_MINIUPNP_UPNP=1" & flags & " " & packageName)
|
|
exec(docker & " run --rm --cap-add=NET_ADMIN -e TEST_MINIUPNP_NATPMP=1" & flags & " " & packageName)
|