Enable log folding in Travis CI (#10414)

Prevent log truncation in browsers
This commit is contained in:
Federico Ceratto 2019-01-22 14:50:50 +00:00 • committed by Andreas Rumpf
commit 54fecdb8df
2 changed files with 23 additions and 11 deletions

View file

@ -80,6 +80,9 @@ let kochExe* = when isMainModule: os.getAppFilename() # always correct when koch
proc kochExec*(cmd: string) = proc kochExec*(cmd: string) =
exec kochExe.quoteShell & " " & cmd exec kochExe.quoteShell & " " & cmd
proc kochExecFold*(desc, cmd: string) =
execFold(desc, kochExe.quoteShell & " " & cmd)
template withDir(dir, body) = template withDir(dir, body) =
let old = getCurrentDir() let old = getCurrentDir()
try: try:
@ -453,11 +456,11 @@ proc runCI(cmd: string) =
# note(@araq): Do not replace these commands with direct calls (eg boot()) # note(@araq): Do not replace these commands with direct calls (eg boot())
# as that would weaken our testing efforts. # as that would weaken our testing efforts.
when defined(posix): # appveyor (on windows) didn't run this when defined(posix): # appveyor (on windows) didn't run this
kochExec "boot" kochExecFold("Boot", "boot")
kochExec "boot -d:release" kochExecFold("Boot in release mode", "boot -d:release")
## build nimble early on to enable remainder to depend on it if needed ## build nimble early on to enable remainder to depend on it if needed
kochExec "nimble" kochExecFold("Build Nimble", "nimble")
when false: when false:
for pkg in "zip opengl sdl1 jester@#head niminst".split: for pkg in "zip opengl sdl1 jester@#head niminst".split:
@ -466,23 +469,23 @@ proc runCI(cmd: string) =
buildTools() # altenatively, kochExec "tools --toolsNoNimble" buildTools() # altenatively, kochExec "tools --toolsNoNimble"
## run tests ## run tests
exec "nim e tests/test_nimscript.nims" execFold("Test nimscript", "nim e tests/test_nimscript.nims")
when defined(windows): when defined(windows):
# note: will be over-written below # note: will be over-written below
exec "nim c -d:nimCoroutines --os:genode -d:posix --compileOnly testament/tester" execFold("Compile tester", "nim c -d:nimCoroutines --os:genode -d:posix --compileOnly testament/tester")
# main bottleneck here # main bottleneck here
exec "nim c -r -d:nimCoroutines testament/tester --pedantic all -d:nimCoroutines" execFold("Run tester", "nim c -r -d:nimCoroutines testament/tester --pedantic all -d:nimCoroutines")
exec "nim c -r nimdoc/tester" execFold("Run nimdoc tests", "nim c -r nimdoc/tester")
exec "nim c -r nimpretty/tester.nim" execFold("Run nimpretty tests", "nim c -r nimpretty/tester.nim")
when defined(posix): when defined(posix):
exec "nim c -r nimsuggest/tester" execFold("Run nimsuggest tests", "nim c -r nimsuggest/tester")
## remaining actions ## remaining actions
when defined(posix): when defined(posix):
kochExec "docs --git.commit:devel" kochExecFold("Docs", "docs --git.commit:devel")
kochExec "csource" kochExecFold("C sources", "csource")
elif defined(windows): elif defined(windows):
when false: when false:
kochExec "csource" kochExec "csource"

View file

@ -38,6 +38,15 @@ proc exec*(cmd: string, errorcode: int = QuitFailure, additionalPath = "") =
if execShellCmd(cmd) != 0: quit("FAILURE", errorcode) if execShellCmd(cmd) != 0: quit("FAILURE", errorcode)
putEnv("PATH", prevPath) putEnv("PATH", prevPath)
proc execFold*(desc, cmd: string, errorcode: int = QuitFailure, additionalPath = "") =
## Execute shell command. Add log folding on Travis CI.
# https://github.com/travis-ci/travis-ci/issues/2285#issuecomment-42724719
if existsEnv("TRAVIS"):
echo "travis_fold:start:" & desc.replace(" ", "")
exec(cmd, errorcode, additionalPath)
if existsEnv("TRAVIS"):
echo "travis_fold:end:" & desc.replace(" ", "")
proc execCleanPath*(cmd: string, proc execCleanPath*(cmd: string,
additionalPath = ""; errorcode: int = QuitFailure) = additionalPath = ""; errorcode: int = QuitFailure) =
# simulate a poor man's virtual environment # simulate a poor man's virtual environment