mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-11-15 04:17:53 -06:00
add reporting to cache build
This commit is contained in:
parent
e012d5d854
commit
e77fdc7381
1 changed files with 20 additions and 1 deletions
|
@ -297,6 +297,23 @@ func outputsPaths(o: OizysDerivation): seq[string] =
|
||||||
for _, output in o.drv.outputs:
|
for _, output in o.drv.outputs:
|
||||||
result.add output.path
|
result.add output.path
|
||||||
|
|
||||||
|
proc reportResults(results: seq[(OizysDerivation, BuildResult)]) =
|
||||||
|
let rows = collect(
|
||||||
|
for (drv, res) in results:
|
||||||
|
let (name, hash) = splitDrv(drv.name)
|
||||||
|
fmt"| {name} | `{hash}` | " & (
|
||||||
|
if res.successful: ":white_check_mark:"
|
||||||
|
else: ":x:"
|
||||||
|
) & " |"
|
||||||
|
)
|
||||||
|
let summaryFilePath = getEnv("GITHUB_STEP_SUMMARY")
|
||||||
|
if summaryFilePath == "": fatalQuit "no github step summary found"
|
||||||
|
let output = open(summaryFilePath,fmAppend)
|
||||||
|
output.writeLine("| derivation | hash | build successful |\n|---|---|---|")
|
||||||
|
output.writeLine(rows.join("\n"))
|
||||||
|
close output
|
||||||
|
|
||||||
|
|
||||||
proc nixBuildWithCache*(name: string, rest:seq[string], service: string, jobs: int) =
|
proc nixBuildWithCache*(name: string, rest:seq[string], service: string, jobs: int) =
|
||||||
## build individual derivations not cached and push to cache
|
## build individual derivations not cached and push to cache
|
||||||
if findExe(service) == "": fatalQuit fmt"is {service} installed?"
|
if findExe(service) == "": fatalQuit fmt"is {service} installed?"
|
||||||
|
@ -312,12 +329,14 @@ proc nixBuildWithCache*(name: string, rest:seq[string], service: string, jobs: i
|
||||||
for drv in drvs:
|
for drv in drvs:
|
||||||
(drv, build(drv, rest))
|
(drv, build(drv, rest))
|
||||||
|
|
||||||
# TODO: add back reporting to GITHUB SUMMARY
|
|
||||||
var outs: seq[string]
|
var outs: seq[string]
|
||||||
for (drv, res) in results:
|
for (drv, res) in results:
|
||||||
if res.successful:
|
if res.successful:
|
||||||
outs &= drv.outputsPaths
|
outs &= drv.outputsPaths
|
||||||
|
|
||||||
|
if isCi():
|
||||||
|
reportResults(results)
|
||||||
|
|
||||||
# TODO: push after build not at once?
|
# TODO: push after build not at once?
|
||||||
var cmd = service
|
var cmd = service
|
||||||
cmd.addArg "push"
|
cmd.addArg "push"
|
||||||
|
|
Loading…
Reference in a new issue