Misc updates and stuff /o\

This commit is contained in:
Alexandre Aubin 2020-09-03 17:33:59 +00:00
parent b37a80a51f
commit 2e24e858ee
11 changed files with 34 additions and 51 deletions

View file

@ -53,7 +53,11 @@ def appci_branch(branch):
app_results = sort_test_results(branch.most_recent_tests_per_app()) app_results = sort_test_results(branch.most_recent_tests_per_app())
return render_template("appci_branch.html", tests=AppCI.tests, tests = AppCI.tests.copy()
if "Malformed path" in tests:
tests.remove("Malformed path")
return render_template("appci_branch.html", tests=tests,
branch=branch, branch=branch,
app_results=app_results) app_results=app_results)
@ -68,7 +72,10 @@ def appci_app(app):
for r in branch_results: for r in branch_results:
r.level = -1 if r.level in ["?", None] else int(r.level) r.level = -1 if r.level in ["?", None] else int(r.level)
return render_template("appci_app.html", tests=AppCI.tests, tests = AppCI.tests.copy()
if "Malformed path" in tests:
tests.remove("Malformed path")
return render_template("appci_app.html", tests=tests,
app=app, app=app,
branch_results=branch_results) branch_results=branch_results)

View file

@ -47,13 +47,6 @@ class AppCIBranch(db.Model):
url='https://ci-apps-unstable.yunohost.org/ci/logs/list_level_unstable.json', url='https://ci-apps-unstable.yunohost.org/ci/logs/list_level_unstable.json',
url_per_app='https://ci-apps-unstable.yunohost.org/ci/apps/{}/') url_per_app='https://ci-apps-unstable.yunohost.org/ci/apps/{}/')
yield AppCIBranch(name='buster',
arch="x86",
branch="buster",
display_name='buster (x86)',
url='https://ci-buster.nohost.me/ci/logs/list_level_stable.json',
url_per_app='https://ci-buster.nohost.me/ci/apps/{}/')
def last_build_url(self, app): def last_build_url(self, app):
return self.url_per_app.format(app.name) return self.url_per_app.format(app.name)
@ -104,6 +97,10 @@ class AppCIResult(db.Model):
s_dict = { True: +1, False: -1, None: 0 } s_dict = { True: +1, False: -1, None: 0 }
return sum([ s_dict[result] for result in self.results.values() ]) return sum([ s_dict[result] for result in self.results.values() ])
@property
def outdated(self):
return (datetime.datetime.now() - self.date).days > 45
class AppCI(): class AppCI():

View file

@ -97,10 +97,11 @@ class AppList(db.Model):
known_app.opened_issues = 0 known_app.opened_issues = 0
known_app.opened_prs = 0 known_app.opened_prs = 0
try: try:
db.session.commit() db.session.commit()
except Exception as e: except Exception as e:
print(e) print(e)
db.session.rollback()
class App(db.Model): class App(db.Model):

View file

@ -141,12 +141,9 @@ def get_status_and_todo(repo):
def get_apps_to_check(): def get_apps_to_check():
#official="https://raw.githubusercontent.com/YunoHost/apps/master/official.json" community="https://raw.githubusercontent.com/YunoHost/apps/master/apps.json"
community="https://raw.githubusercontent.com/YunoHost/apps/master/community.json"
raw_apps = [] raw_apps = json.loads(requests.get(community).text).values()
#raw_apps += json.loads(requests.get(official).text).values()
raw_apps += json.loads(requests.get(community).text).values()
return [ app["url"].replace("https://github.com/","") \ return [ app["url"].replace("https://github.com/","") \
for app in raw_apps \ for app in raw_apps \
@ -196,7 +193,7 @@ def run_todolist(todolist):
def update_community_list(status, workdir): def update_community_list(status, workdir):
filename = workdir + "/community.json" filename = workdir + "/apps.json"
j = json.loads(open(filename).read()) j = json.loads(open(filename).read())
@ -253,7 +250,7 @@ def create_pull_request(repo, watdo, pr_infos):
cmds = [ cmds = [
"cd .work/{reponame} && git add .", "cd .work/{reponame} && git add .",
"cd .work/{reponame} && git commit -a -m '{title}'", "cd .work/{reponame} && git commit -a -m '{title}'",
"cd .work/{reponame} && git push origin {branch}" "cd .work/{reponame} && git push origin {branch} --force"
] ]
for cmd in cmds: for cmd in cmds:

View file

@ -24,7 +24,7 @@
</thead> </thead>
<tbody> <tbody>
{% for result in branch_results %} {% for result in branch_results %}
<tr branch="{{ result.branch.name }}"> <tr branch="{{ result.branch.name }}" {% if result.outdated %}style="opacity: 0.5"{% endif %} >
<td class="ci-app-row-title"> <td class="ci-app-row-title">
<a href="{{ url_for('main.appci_branch', branch=result.branch.name) }}"> <a href="{{ url_for('main.appci_branch', branch=result.branch.name) }}">
<span title="Branch"> <span title="Branch">
@ -45,10 +45,10 @@
{% else %} {% else %}
<span class="daysAgo" timestamp="{{ result.date.timestamp() }}" href="{{ result.branch.last_build_url(app) }}"></span> <span class="daysAgo" timestamp="{{ result.date.timestamp() }}" href="{{ result.branch.last_build_url(app) }}"></span>
{% endif %} {% endif %}
{% if result.commit != result.app.master_commit %} {% if result.outdated %}
<span class="oi oi-clock text-warning" <span class="oi oi-clock text-warning"
aria-hidden="true" aria-hidden="true"
title="This test is outdated : a more recent commit exists in master than the one tested."></span> title="This test is outdated"></span>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>

View file

@ -43,7 +43,6 @@
<input type="radio" name="options" level="8" autocomplete="off"> 8 <input type="radio" name="options" level="8" autocomplete="off"> 8
</label> </label>
</div> </div>
<button id="filter_onlyOfficials" type="button" class="btn btn-light btn-sm" href="javascript:void(0)" onclick="toggle(this)" style="margin-left:30px;">Show only officials</button>
</div> </div>
<div> <div>
<table class="table table-responsive ci-app-table"> <table class="table table-responsive ci-app-table">
@ -60,11 +59,8 @@
</thead> </thead>
<tbody> <tbody>
{% for result in app_results %} {% for result in app_results %}
<tr app="{{ result.app.name }}" class="resultline {% if result.app.list.name == "official" %}official{% endif %}" level="{{ result.level if result.level >= 0 else "?" }}"> <tr app="{{ result.app.name }}" class="resultline" level="{{ result.level if result.level >= 0 else "?" }}" {% if result.outdated %}style="opacity: 0.5"{% endif %} >
<td class="ci-app-row-title"> <td class="ci-app-row-title">
{% if result.app.list.name == "official" %}
<span class="official-star oi oi-star" title="Official" aria-hidden="true"></span>
{% endif %}
<a href="{{ url_for('main.appci_app', app=result.app.name) }}"> <a href="{{ url_for('main.appci_app', app=result.app.name) }}">
<span class="font-weight-bold" title="More tests / info for this app"> <span class="font-weight-bold" title="More tests / info for this app">
{{ result.app.name }}</span> {{ result.app.name }}</span>
@ -84,10 +80,10 @@
{% else %} {% else %}
<span class="daysAgo" timestamp="{{ result.date.timestamp() }}" href="{{ branch.last_build_url(result.app) }}"></span> <span class="daysAgo" timestamp="{{ result.date.timestamp() }}" href="{{ branch.last_build_url(result.app) }}"></span>
{% endif %} {% endif %}
{% if result.commit != result.app.master_commit %} {% if result.outdated %}
<span class="oi oi-clock text-warning" <span class="oi oi-clock text-warning"
aria-hidden="true" aria-hidden="true"
title="This test is outdated : a more recent commit exists in master than the one tested."></span> title="This test is outdated"></span>
{% endif %} {% endif %}
{% if result.app.public_commit != 'HEAD' and result.app.public_commit != result.app.master_commit %} {% if result.app.public_commit != 'HEAD' and result.app.public_commit != result.app.master_commit %}
<!-- <!--
@ -159,10 +155,8 @@ function toggle(e) {
} }
function update_filters() { function update_filters() {
var onlyOfficials = $("#filter_onlyOfficials").hasClass("btn-primary");
var levelFilter = $("input[type='radio']:checked").attr("level"); var levelFilter = $("input[type='radio']:checked").attr("level");
$(".resultline").show(); $(".resultline").show();
if (onlyOfficials) { $(".resultline:not(.official)").hide(); }
if (levelFilter != "all") { $(".resultline[level!='"+levelFilter+"']").hide(); } if (levelFilter != "all") { $(".resultline[level!='"+levelFilter+"']").hide(); }
} }

View file

@ -8,7 +8,6 @@
<div class="mx-auto"> <div class="mx-auto">
<div style="text-align:center;"> <div style="text-align:center;">
<button id="filter_onlyDiffs" type="button" class="btn btn-primary btn-sm" href="javascript:void(0)" onclick="toggle(this)">Show only diffs</button> <button id="filter_onlyDiffs" type="button" class="btn btn-primary btn-sm" href="javascript:void(0)" onclick="toggle(this)">Show only diffs</button>
<button id="filter_onlyOfficials" type="button" class="btn btn-light btn-sm" href="javascript:void(0)" onclick="toggle(this)">Show only officials</button>
</div> </div>
<div> <div>
<table class="table table-responsive ci-app-table"> <table class="table table-responsive ci-app-table">
@ -22,11 +21,8 @@
</thead> </thead>
<tbody> <tbody>
{% for result in results %} {% for result in results %}
<tr class="ci-branch-comparison {% if result.app.list.name == "official" %}official{% endif %}" value="{{ result.compare }}" app="{{ result.app.name }}"> <tr class="ci-branch-comparison" value="{{ result.compare }}" app="{{ result.app.name }}">
<td class="ci-app-row-title"> <td class="ci-app-row-title">
{% if result.app.list.name == "official" %}
<span class="official-star oi oi-star" title="Official" aria-hidden="true"></span>
{% endif %}
<a href="{{ url_for('main.appci_app', app=result.app.name) }}"> <a href="{{ url_for('main.appci_app', app=result.app.name) }}">
<span title="App"> <span title="App">
<strong>{{ result.app.name }}</strong></span> <strong>{{ result.app.name }}</strong></span>
@ -89,10 +85,8 @@ function toggle(e) {
} }
function update_filters() { function update_filters() {
var onlyDiffs = $("#filter_onlyDiffs").hasClass("btn-primary"); var onlyDiffs = $("#filter_onlyDiffs").hasClass("btn-primary");
var onlyOfficials = $("#filter_onlyOfficials").hasClass("btn-primary");
$(".ci-branch-comparison").show(); $(".ci-branch-comparison").show();
if (onlyDiffs) { $(".ci-branch-comparison[value='same']").hide(); } if (onlyDiffs) { $(".ci-branch-comparison[value='same']").hide(); }
if (onlyOfficials) { $(".ci-branch-comparison:not(.official)").hide(); }
} }
</script> </script>

View file

@ -30,7 +30,7 @@ window.onload = function () {
var chart = new CanvasJS.Chart("levelHistory", { var chart = new CanvasJS.Chart("levelHistory", {
animationEnabled: false, animationEnabled: false,
title:{ title:{
text: "Apps level (officials + community working)" text: "Apps quality level (from automatic tests)"
}, },
toolTip: { toolTip: {
reversed: true, reversed: true,
@ -58,7 +58,7 @@ window.onload = function () {
var chart2 = new CanvasJS.Chart("stateHistory", { var chart2 = new CanvasJS.Chart("stateHistory", {
animationEnabled: false, animationEnabled: false,
title:{ title:{
text: "Apps state" text: "Apps state (declared by packager)"
}, },
toolTip: { toolTip: {
reversed: true, reversed: true,

View file

@ -35,13 +35,11 @@
<a class="dropdown-item" href="{{ url_for('main.appci_branch', branch="testing")}}">Testing</a> <a class="dropdown-item" href="{{ url_for('main.appci_branch', branch="testing")}}">Testing</a>
<a class="dropdown-item" href="{{ url_for('main.appci_branch', branch="unstable")}}">Unstable</a> <a class="dropdown-item" href="{{ url_for('main.appci_branch', branch="unstable")}}">Unstable</a>
<a class="dropdown-item" href="{{ url_for('main.appci_branch', branch="arm")}}">ARM</a> <a class="dropdown-item" href="{{ url_for('main.appci_branch', branch="arm")}}">ARM</a>
<a class="dropdown-item" href="{{ url_for('main.appci_branch', branch="buster")}}">Buster</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<span class="dropdown-header">Branch comparisons</span> <span class="dropdown-header">Branch comparisons</span>
<a class="dropdown-item" href="{{ url_for('main.appci_compare', ref="stable", target="testing")}}">Stable vs. Testing</a> <a class="dropdown-item" href="{{ url_for('main.appci_compare', ref="stable", target="testing")}}">Stable vs. Testing</a>
<a class="dropdown-item" href="{{ url_for('main.appci_compare', ref="stable", target="unstable")}}">Stable vs. Unstable</a> <a class="dropdown-item" href="{{ url_for('main.appci_compare', ref="stable", target="unstable")}}">Stable vs. Unstable</a>
<a class="dropdown-item" href="{{ url_for('main.appci_compare', ref="stable", target="arm")}}">Stable vs. ARM</a> <a class="dropdown-item" href="{{ url_for('main.appci_compare', ref="stable", target="arm")}}">Stable vs. ARM</a>
<a class="dropdown-item" href="{{ url_for('main.appci_compare', ref="stable", target="buster")}}">Stable vs. Buster</a>
</div> </div>
</li> </li>
<li class="nav-item dropdown"> <li class="nav-item dropdown">

View file

@ -45,9 +45,7 @@ Active maintainers :
<td> <td>
{% if app.list.name == "official" %} {% if app.state == "working" %}
<span class="official-star oi oi-star" title="Official" aria-hidden="true"></span>
{% elif app.state == "working" %}
<span class="text-success oi oi-circle-check" title="Working" aria-hidden="true"></span> <span class="text-success oi oi-circle-check" title="Working" aria-hidden="true"></span>
{% elif app.state == "inprogress" %} {% elif app.state == "inprogress" %}
<span class="text-warning oi oi-wrench" title="In progress" aria-hidden="true"></span> <span class="text-warning oi oi-wrench" title="In progress" aria-hidden="true"></span>
@ -78,7 +76,7 @@ Active maintainers :
table-active table-active
{% elif app.public_level <= 0 %} {% elif app.public_level <= 0 %}
table-danger table-danger
{% elif app.public_level <= 2 %} {% elif app.public_level <= 4 %}
table-warning table-warning
{% else %} {% else %}
table-success table-success
@ -93,7 +91,7 @@ Active maintainers :
table-active table-active
{% elif app.ci_level <= 0 %} {% elif app.ci_level <= 0 %}
table-danger table-danger
{% elif app.ci_level <= 2 %} {% elif app.ci_level <= 4 %}
table-warning table-warning
{% else %} {% else %}
table-success table-success

View file

@ -20,9 +20,6 @@
<tr class="appline" app="{{ app.name }}"> <tr class="appline" app="{{ app.name }}">
<td class="ci-app-row-title"> <td class="ci-app-row-title">
{% if app.list.name == "official" %}
<span class="official-star oi oi-star" title="Official" aria-hidden="true"></span>
{% endif %}
<a href="{{ url_for('main.appci_app', app=app.name) }}"> <a href="{{ url_for('main.appci_app', app=app.name) }}">
<span class="font-weight-bold" title="More tests / info for this app"> <span class="font-weight-bold" title="More tests / info for this app">
{{ app.name }}</span> {{ app.name }}</span>