Skip to content

Commit

Permalink
refs #8638 nimble-wide CI: first pass
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Jan 9, 2019
1 parent 0229dfd commit a920bef
Showing 1 changed file with 71 additions and 1 deletion.
72 changes: 71 additions & 1 deletion koch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ Boot options:
for bootstrapping
Commands for core developers:
runCI runs continuous integration (CI), eg from travis
runCI runs CI (continuous integration)
on travis/appveyor
on select nimble packages
runcipackages runs CI on nimble packages
docs [options] generates the full documentation
csource -d:release builds the C sources for installation
pdf builds the PDF documentation
Expand Down Expand Up @@ -431,6 +434,70 @@ proc xtemp(cmd: string) =
finally:
copyExe(d / "bin" / "nim_backup".exe, d / "bin" / "nim".exe)


type CIResult = object
numSeen: int
numCompileOK: int
numCompileFail: int
numFail: int

proc runCIPackage(data: var CIResult, pkg: string) =
echo "runCIPackage:", pkg
let pkgOutDir = "nimbleRoot"
data.numSeen.inc
let cmd = "nimble install --nimbleDir:$# -y $# " % [pkgOutDir, pkg]
echo cmd
# if true: return
let status = execShellCmd(cmd)
if status != 0:
data.numCompileFail.inc
return
data.numCompileOK.inc

# todo: run `nimble test` for pkg
# Note: `nimble test foo` isn't supported
# Note: `nimble test` can't be run from `nimble install`' d location

proc runCIPackages(cmd: string) =
doAssert cmd.len == 0, cmd # avoid silently ignoring
echo "runCIPackages:", cmd

var data: CIResult

#TODO: jester@#head or jester? etc
let pkgs = """
jester
cligen
libffi
glob
nimongo
nimx
karax
freeimage
regex
nimpy
zero_functional
arraymancer
inim
c2nim
sdl1
iterutils
gnuplot
nimpb
lazy
choosenim
""".split[0..^2] # remove last (emtpy) entry

echo pkgs

for i,pkg in pkgs:
if pkg == "": continue
runCIPackage(data, pkg)
echo (count:i, n: pkgs.len, data:data)

echo (final: data)
# todo: send a notification, gather stats on failed packages

proc runCI(cmd: string) =
doAssert cmd.len == 0, cmd # avoid silently ignoring
echo "runCI:", cmd
Expand All @@ -441,6 +508,8 @@ proc runCI(cmd: string) =
exec("env NIM_COMPILE_TO_CPP=false $1 boot" % kochExe.quoteShell)
kochExec "boot -d:release"
kochExec "nimble"
runCIPackages("")

exec "nim e tests/test_nimscript.nims"

when false:
Expand Down Expand Up @@ -576,6 +645,7 @@ when isMainModule:
of "install": install(op.cmdLineRest)
of "testinstall": testUnixInstall(op.cmdLineRest)
of "runci": runCI(op.cmdLineRest)
of "runcipackages": runCIPackages(op.cmdLineRest)
of "test", "tests": tests(op.cmdLineRest)
of "temp": temp(op.cmdLineRest)
of "xtemp": xtemp(op.cmdLineRest)
Expand Down

0 comments on commit a920bef

Please sign in to comment.