[CI] fixes #10041 move bulk of travis and appveyor logic to koch.nim (#10183)

This commit is contained in:
Timothee Cour 2019-01-08 04:08:19 -08:00 • committed by Andreas Rumpf
commit c60916a2af
4 changed files with 53 additions and 38 deletions

View file

@ -40,26 +40,11 @@ before_script:
- sh build.sh - sh build.sh
- cd .. - cd ..
- export PATH=$(pwd)/bin${PATH:+:$PATH} - export PATH=$(pwd)/bin${PATH:+:$PATH}
- echo PATH:${PATH}
script: script:
- nim c koch - nim c koch
- env NIM_COMPILE_TO_CPP=false ./koch boot - ./koch runCI
- ./koch boot -d:release
- ./koch nimble
- nim e tests/test_nimscript.nims
#- nimble install zip -y
#- nimble install opengl
#- nimble install sdl1
#- nimble install jester@#head -y
#- nimble install niminst
- nim c -d:nimCoroutines testament/tester
- testament/tester --pedantic all -d:nimCoroutines
- nim c -o:bin/nimpretty nimpretty/nimpretty.nim
- nim c -r nimpretty/tester.nim
- ./koch docs --git.commit:devel
- ./koch csource
- ./koch nimsuggest
- nim c -r nimsuggest/tester
- nim c -r nimdoc/tester
before_deploy: before_deploy:
# Make https://nim-lang.github.io/Nim work the same as https://nim-lang.github.io/Nim/overview.html # Make https://nim-lang.github.io/Nim work the same as https://nim-lang.github.io/Nim/overview.html

View file

@ -44,22 +44,6 @@ install:
build_script: build_script:
- bin\nim c koch - bin\nim c koch
- koch boot -d:release - koch runCI
- koch nimble
- nim e tests/test_nimscript.nims
- nim c -o:bin/nimpretty.exe nimpretty/nimpretty.nim
- nim c -r nimpretty/tester.nim
# - nimble install zip -y
# - nimble install opengl -y
# - nimble install sdl1 -y
# - nimble install jester@#head -y
- nim c -d:nimCoroutines --os:genode -d:posix --compileOnly testament/tester
- nim c -d:nimCoroutines testament/tester
test_script:
- testament\tester --pedantic all -d:nimCoroutines
- nim c -r nimdoc\tester
# - koch csource
# - koch zip
deploy: off deploy: off

View file

@ -26,6 +26,7 @@ import
import tools / kochdocs import tools / kochdocs
const VersionAsString = system.NimVersion const VersionAsString = system.NimVersion
const env_NIM_COMPILE_TO_CPP = "NIM_COMPILE_TO_CPP"
const const
HelpText = """ HelpText = """
@ -56,6 +57,7 @@ Boot options:
for bootstrapping for bootstrapping
Commands for core developers: Commands for core developers:
runCI runs continuous integration (CI), eg from travis
docs [options] generates the full documentation docs [options] generates the full documentation
csource -d:release builds the C sources for installation csource -d:release builds the C sources for installation
pdf builds the PDF documentation pdf builds the PDF documentation
@ -272,8 +274,9 @@ proc boot(args: string) =
var output = "compiler" / "nim".exe var output = "compiler" / "nim".exe
var finalDest = "bin" / "nim".exe var finalDest = "bin" / "nim".exe
# default to use the 'c' command: # 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: "" 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_") & let smartNimcache = (if "release" in args: "nimcache/r_" else: "nimcache/d_") &
hostOs & "_" & hostCpu hostOs & "_" & hostCpu
@ -352,8 +355,8 @@ proc winReleaseArch(arch: string) =
# Rebuilding koch is necessary because it uses its pointer size to # Rebuilding koch is necessary because it uses its pointer size to
# determine which mingw link to put in the NSIS installer. # determine which mingw link to put in the NSIS installer.
nimexec "c --cpu:$# koch" % cpu nimexec "c --cpu:$# koch" % cpu
exec "koch boot -d:release --cpu:$#" % cpu kochExec "boot -d:release --cpu:$#" % cpu
exec "koch --latest zip -d:release" kochExec "--latest zip -d:release"
overwriteFile r"build\nim-$#.zip" % VersionAsString, overwriteFile r"build\nim-$#.zip" % VersionAsString,
r"web\upload\download\nim-$#_x$#.zip" % [VersionAsString, arch] r"web\upload\download\nim-$#_x$#.zip" % [VersionAsString, arch]
@ -428,6 +431,42 @@ proc xtemp(cmd: string) =
finally: finally:
copyExe(d / "bin" / "nim_backup".exe, d / "bin" / "nim".exe) 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() = proc pushCsources() =
if not dirExists("../csources/.git"): if not dirExists("../csources/.git"):
quit "[Error] no csources git repository found" quit "[Error] no csources git repository found"
@ -536,6 +575,7 @@ when isMainModule:
of "distrohelper": geninstall() of "distrohelper": geninstall()
of "install": install(op.cmdLineRest) of "install": install(op.cmdLineRest)
of "testinstall": testUnixInstall(op.cmdLineRest) of "testinstall": testUnixInstall(op.cmdLineRest)
of "runci": runCI(op.cmdLineRest)
of "test", "tests": tests(op.cmdLineRest) of "test", "tests": tests(op.cmdLineRest)
of "temp": temp(op.cmdLineRest) of "temp": temp(op.cmdLineRest)
of "xtemp": xtemp(op.cmdLineRest) of "xtemp": xtemp(op.cmdLineRest)

View file

@ -51,6 +51,12 @@ proc execCleanPath*(cmd: string,
if execShellCmd(cmd) != 0: quit("FAILURE", errorcode) if execShellCmd(cmd) != 0: quit("FAILURE", errorcode)
putEnv("PATH", prevPath) putEnv("PATH", prevPath)
let kochExe* = os.getAppFilename()
# note: assumes `kochdocs` is only used by koch.nim
proc kochExec*(cmd: string) =
exec kochExe.quoteShell & " " & cmd
proc nimexec*(cmd: string) = proc nimexec*(cmd: string) =
# Consider using `nimCompile` instead # Consider using `nimCompile` instead
exec findNim() & " " & cmd exec findNim() & " " & cmd