Commit 26b1e151 authored by Laurent Peuch's avatar Laurent Peuch
Browse files

feat(qa): generate badges for projects matching QA dashboard

parent 8744d30ccfb0
Pipeline #18081 passed with stages
in 4 minutes and 45 seconds
#!/usr/bin/env python3
import os
import anybadge
import requests
import gitlab
import jinja2
......@@ -102,7 +103,7 @@ for number, cube in enumerate(all_cubes):
has_flake8 = False
has_from_forge = False
context["cubes"].append({
markers = {
"cube": cube.attributes,
"has_doc": has_doc,
"has_readthedocs": has_readthedocs,
......@@ -121,7 +122,33 @@ for number, cube in enumerate(all_cubes):
"has_capture_deprecated_warnings": has_capture_deprecated_warnings,
"number_of_mrs": number_of_mrs,
"number_of_topics": number_of_topics,
})
}
badges_path = f"public/qa/badges/{cube.id}/"
if not os.path.exists(badges_path):
os.makedirs(badges_path)
for key, value in markers.items():
if key in ("cube", "number_of_mrs", "number_of_topics"):
continue
name = key.replace("has_", "")
path = os.path.join(badges_path, name + ".svg")
text = name.replace("_", " ")
if value:
color = "green"
displayed_value = "yes"
elif value is None:
color = "white"
displayed_value = " "
elif not value:
color = "red"
displayed_value = "no"
anybadge.Badge(text, displayed_value, default_color=color).write_badge(path, overwrite=True)
context["cubes"].append(markers)
context["cubes"] = sorted(context["cubes"], key=lambda x: x["cube"]["name"].lower())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment