Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
dashboards
Commits
e5502f68fb46
Commit
26b1e151
authored
Oct 21, 2020
by
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
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
qa_dashboard.py
View file @
e5502f68
#!/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
())
...
...
requirements.txt
View file @
e5502f68
...
...
@@ -4,3 +4,4 @@ tox
requests
rdflib
pygments
anybadge
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment