Adding badges

This commit is contained in:
Alexandre Aubin 2018-01-29 13:53:51 -05:00
parent 41a882be09
commit 3092846186
11 changed files with 41 additions and 1 deletions

View file

@ -1,4 +1,4 @@
from flask import render_template, Blueprint from flask import render_template, make_response, Blueprint
from .models.pr import PullRequest from .models.pr import PullRequest
from .models.appci import App, AppCI, AppCIBranch from .models.appci import App, AppCI, AppCIBranch
from .settings import SITE_ROOT from .settings import SITE_ROOT
@ -86,3 +86,25 @@ def appci_compare(ref, target):
target=target, target=target,
results=ref_results) results=ref_results)
@main.route('/integration/<app>')
@main.route('/integration/<app>.svg')
def badge(app):
app = App.query.filter_by(name=app).first_or_404()
branch_results = list(app.most_recent_tests_per_branch())
level = None
for r in branch_results:
if r.branch.name == "stable":
level = r.level
break
badge = "level%s.svg" % level if level else "unknown.svg"
svg = open("./app/static/badges/%s" % badge).read()
response = make_response(svg)
response.content_type = 'image/svg+xml'
response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
response.headers['Pragma'] = 'no-cache'
return response

View file

@ -0,0 +1,9 @@
wget -O - https://img.shields.io/badge/Integration-Level_7-brightgreen.svg > level7.svg
wget -O - https://img.shields.io/badge/Integration-Level_6-green.svg > level6.svg
wget -O - https://img.shields.io/badge/Integration-Level_5-green.svg > level5.svg
wget -O - https://img.shields.io/badge/Integration-Level_4-yellowgreen.svg > level4.svg
wget -O - https://img.shields.io/badge/Integration-Level_3-yellow.svg > level3.svg
wget -O - https://img.shields.io/badge/Integration-Level_2-yellow.svg > level2.svg
wget -O - https://img.shields.io/badge/Integration-Level_1-orange.svg > level1.svg
wget -O - https://img.shields.io/badge/Integration-Level_0-red.svg > level0.svg
wget -O - https://img.shields.io/badge/Integration-Unknown-lightgrey.svg > unknown.svg

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="120" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="120" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h71v20H0z"/><path fill="#e05d44" d="M71 0h49v20H71z"/><path fill="url(#b)" d="M0 0h120v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="365" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="610">Integration</text><text x="365" y="140" transform="scale(.1)" textLength="610">Integration</text><text x="945" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="390">Level 0</text><text x="945" y="140" transform="scale(.1)" textLength="390">Level 0</text></g> </svg>

After

Width:  |  Height:  |  Size: 968 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="120" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="120" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h71v20H0z"/><path fill="#fe7d37" d="M71 0h49v20H71z"/><path fill="url(#b)" d="M0 0h120v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="365" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="610">Integration</text><text x="365" y="140" transform="scale(.1)" textLength="610">Integration</text><text x="945" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="390">Level 1</text><text x="945" y="140" transform="scale(.1)" textLength="390">Level 1</text></g> </svg>

After

Width:  |  Height:  |  Size: 968 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="120" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="120" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h71v20H0z"/><path fill="#dfb317" d="M71 0h49v20H71z"/><path fill="url(#b)" d="M0 0h120v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="365" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="610">Integration</text><text x="365" y="140" transform="scale(.1)" textLength="610">Integration</text><text x="945" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="390">Level 2</text><text x="945" y="140" transform="scale(.1)" textLength="390">Level 2</text></g> </svg>

After

Width:  |  Height:  |  Size: 968 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="120" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="120" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h71v20H0z"/><path fill="#dfb317" d="M71 0h49v20H71z"/><path fill="url(#b)" d="M0 0h120v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="365" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="610">Integration</text><text x="365" y="140" transform="scale(.1)" textLength="610">Integration</text><text x="945" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="390">Level 3</text><text x="945" y="140" transform="scale(.1)" textLength="390">Level 3</text></g> </svg>

After

Width:  |  Height:  |  Size: 968 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="120" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="120" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h71v20H0z"/><path fill="#a4a61d" d="M71 0h49v20H71z"/><path fill="url(#b)" d="M0 0h120v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="365" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="610">Integration</text><text x="365" y="140" transform="scale(.1)" textLength="610">Integration</text><text x="945" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="390">Level 4</text><text x="945" y="140" transform="scale(.1)" textLength="390">Level 4</text></g> </svg>

After

Width:  |  Height:  |  Size: 968 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="120" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="120" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h71v20H0z"/><path fill="#97CA00" d="M71 0h49v20H71z"/><path fill="url(#b)" d="M0 0h120v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="365" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="610">Integration</text><text x="365" y="140" transform="scale(.1)" textLength="610">Integration</text><text x="945" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="390">Level 5</text><text x="945" y="140" transform="scale(.1)" textLength="390">Level 5</text></g> </svg>

After

Width:  |  Height:  |  Size: 968 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="120" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="120" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h71v20H0z"/><path fill="#97CA00" d="M71 0h49v20H71z"/><path fill="url(#b)" d="M0 0h120v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="365" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="610">Integration</text><text x="365" y="140" transform="scale(.1)" textLength="610">Integration</text><text x="945" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="390">Level 6</text><text x="945" y="140" transform="scale(.1)" textLength="390">Level 6</text></g> </svg>

After

Width:  |  Height:  |  Size: 968 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="120" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="120" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h71v20H0z"/><path fill="#4c1" d="M71 0h49v20H71z"/><path fill="url(#b)" d="M0 0h120v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="365" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="610">Integration</text><text x="365" y="140" transform="scale(.1)" textLength="610">Integration</text><text x="945" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="390">Level 7</text><text x="945" y="140" transform="scale(.1)" textLength="390">Level 7</text></g> </svg>

After

Width:  |  Height:  |  Size: 965 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="132" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="132" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h71v20H0z"/><path fill="#9f9f9f" d="M71 0h61v20H71z"/><path fill="url(#b)" d="M0 0h132v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="365" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="610">Integration</text><text x="365" y="140" transform="scale(.1)" textLength="610">Integration</text><text x="1005" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">Unknown</text><text x="1005" y="140" transform="scale(.1)" textLength="510">Unknown</text></g> </svg>

After

Width:  |  Height:  |  Size: 970 B