ctf-tools/bin/travis-ci-status/make_build_status_md.py

45 lines
1.4 KiB
Python
Raw Normal View History

2017-03-10 12:30:13 +00:00
#!/usr/bin/env python
from make_binpacked_travis_ci_conf import *
if __name__ == "__main__":
timingdata = parseOutput(sys.argv[1])
distros = sorted(timingdata.keys()) # all distros seen during previous build
tools = sorted(getToolsFromTimingdata(timingdata)) # all tools seen during previous build
2017-03-10 15:03:49 +00:00
fulltable = []
summarytable = []
fulltable += [" | ".join([""] + distros)]
fulltable += [" | ".join(["-----"] * (1+len(distros)))]
2017-03-10 12:30:13 +00:00
2017-03-10 14:53:50 +00:00
summary = {}
2017-03-10 12:30:13 +00:00
for tool in tools:
parts = []
for distro in distros:
val = "unknown"
if tool in timingdata[distro]:
val = "success" if timingdata[distro][tool]["success"] else "fail"
parts += [val]
2017-03-10 14:53:50 +00:00
if distro not in summary:
summary[distro] = {
"unknown": 0,
"success": 0,
"fail": 0,
"total": 0,
}
summary[distro][val] += 1
summary[distro]["total"] += 1
2017-03-10 15:03:49 +00:00
fulltable += [" | ".join([tool] + ["![{0}]({0}.png)".format(x) for x in parts])]
2017-03-10 14:53:50 +00:00
2017-03-10 15:03:49 +00:00
summarytable += [" | ".join([""] + distros)]
summarytable += [" | ".join(["-----"] * (1+len(distros)))]
2017-03-10 14:53:50 +00:00
for x in ["success", "fail", "unknown"]:
2017-03-10 15:03:49 +00:00
summarytable += [" | ".join(["![{0}]({0}.png)".format(x)] + ["{}".format(summary[d][x]) for d in distros])]
2017-03-10 14:53:50 +00:00
for x in ["total"]:
2017-03-10 15:03:49 +00:00
summarytable += [" | ".join([x] + ["{}".format(summary[d][x]) for d in distros])]
print("\n".join(summarytable))
print("")
print("\n".join(fulltable))