summary refs log tree commit diff stats
path: root/koch.nim
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2019-01-08 04:08:19 -0800
committerAndreas Rumpf <rumpf_a@web.de>2019-01-08 13:08:19 +0100
commitc60916a2aff121fc0220f9452803a7bcfb6300d0 (patch)
tree461f7d4220a949f0d121392d1d9dc5b6026c4f21 /koch.nim
parent6737634d88a70a3d87774c9f51f2ac6d2bf4da4f (diff)
downloadNim-c60916a2aff121fc0220f9452803a7bcfb6300d0.tar.gz
[CI] fixes #10041 move bulk of `travis` and `appveyor` logic to koch.nim (#10183)
Diffstat (limited to 'koch.nim')
-rw-r--r--koch.nim46
1 files changed, 43 insertions, 3 deletions
diff --git a/koch.nim b/koch.nim
index 3082dba8f..afdce3083 100644
--- a/koch.nim
+++ b/koch.nim
@@ -26,6 +26,7 @@ import
 import tools / kochdocs
 
 const VersionAsString = system.NimVersion
+const env_NIM_COMPILE_TO_CPP = "NIM_COMPILE_TO_CPP"
 
 const
   HelpText = """
@@ -56,6 +57,7 @@ Boot options:
                            for bootstrapping
 
 Commands for core developers:
+  runCI                    runs continuous integration (CI), eg from travis
   docs [options]           generates the full documentation
   csource -d:release       builds the C sources for installation
   pdf                      builds the PDF documentation
@@ -272,8 +274,9 @@ proc boot(args: string) =
   var output = "compiler" / "nim".exe
   var finalDest = "bin" / "nim".exe
   # default to use the 'c' command:
-  let defaultCommand = if getEnv("NIM_COMPILE_TO_CPP", "false") == "true": "cpp" else: "c"
+  let defaultCommand = if getEnv(env_NIM_COMPILE_TO_CPP, "false") == "true": "cpp" else: "c"
   let bootOptions = if args.len == 0 or args.startsWith("-"): defaultCommand else: ""
+  echo "boot: defaultCommand: ", defaultCommand, " bootOptions: ", bootOptions
   let smartNimcache = (if "release" in args: "nimcache/r_" else: "nimcache/d_") &
                       hostOs & "_" & hostCpu
 
@@ -352,8 +355,8 @@ proc winReleaseArch(arch: string) =
     # Rebuilding koch is necessary because it uses its pointer size to
     # determine which mingw link to put in the NSIS installer.
     nimexec "c --cpu:$# koch" % cpu
-    exec "koch boot -d:release --cpu:$#" % cpu
-    exec "koch --latest zip -d:release"
+    kochExec "boot -d:release --cpu:$#" % cpu
+    kochExec "--latest zip -d:release"
     overwriteFile r"build\nim-$#.zip" % VersionAsString,
              r"web\upload\download\nim-$#_x$#.zip" % [VersionAsString, arch]
 
@@ -428,6 +431,42 @@ proc xtemp(cmd: string) =
   finally:
     copyExe(d / "bin" / "nim_backup".exe, d / "bin" / "nim".exe)
 
+proc runCI(cmd: string) =
+  doAssert cmd.len == 0, cmd # avoid silently ignoring
+  echo "runCI:", cmd
+  # note(@araq): Do not replace these commands with direct calls (eg boot())
+  # as that would weaken our testing efforts.
+  when defined(posix): # appveyor (on windows) didn't run this
+    # todo: implement `execWithEnv`
+    exec("env NIM_COMPILE_TO_CPP=false $1 boot" % kochExe.quoteShell)
+  kochExec "boot -d:release"
+  kochExec "nimble"
+  exec "nim e tests/test_nimscript.nims"
+
+  when false:
+    for pkg in "zip opengl sdl1 jester@#head niminst".split:
+      exec "nimble install -y" & pkg
+
+  when defined(windows):
+    # note: will be over-written below
+    exec "nim c -d:nimCoroutines --os:genode -d:posix --compileOnly testament/tester"
+    when false:
+      kochExec "csource"
+      kochExec "zip"
+
+  # main bottleneck: runs all main tests
+  exec "nim c -r -d:nimCoroutines testament/tester --pedantic all -d:nimCoroutines"
+  exec "nim c -r nimdoc/tester"
+
+  nimCompile "nimpretty/nimpretty.nim"
+  exec "nim c -r nimpretty/tester.nim"
+
+  when defined(posix):
+    kochExec "docs --git.commit:devel"
+    kochExec "csource"
+    kochExec "nimsuggest"
+    exec "nim c -r nimsuggest/tester"
+
 proc pushCsources() =
   if not dirExists("../csources/.git"):
     quit "[Error] no csources git repository found"
@@ -536,6 +575,7 @@ when isMainModule:
       of "distrohelper": geninstall()
       of "install": install(op.cmdLineRest)
       of "testinstall": testUnixInstall(op.cmdLineRest)
+      of "runci": runCI(op.cmdLineRest)
       of "test", "tests": tests(op.cmdLineRest)
       of "temp": temp(op.cmdLineRest)
       of "xtemp": xtemp(op.cmdLineRest)