From 318992cec5373739f9433dd709b4bd79620e015b Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 16 Apr 2019 15:26:36 +0000 Subject: [PATCH] Various fixes / add testing ci --- app/models/appci.py | 8 ++++++++ app/models/applists.py | 5 ++++- app/models/unlistedapps.py | 8 ++++---- app/templates/applist_history.html | 2 +- app/templates/base.html | 6 +++--- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/app/models/appci.py b/app/models/appci.py index f84e752..8f940a4 100644 --- a/app/models/appci.py +++ b/app/models/appci.py @@ -33,6 +33,13 @@ class AppCIBranch(db.Model): url='https://ci-apps-arm.yunohost.org/ci/logs/list_level_stable.json', url_per_app='https://ci-apps-arm.yunohost.org/ci/apps/{}/') + yield AppCIBranch(name='testing', + arch="x86", + branch="testing", + display_name='Testing (x86)', + url='https://ci-apps-unstable.yunohost.org/ci/logs/list_level_testing.json', + url_per_app='https://ci-apps-unstable.yunohost.org/ci/apps/{}/') + yield AppCIBranch(name='unstable', arch="x86", branch="unstable", @@ -121,6 +128,7 @@ class AppCI(): cleaned_json = [ line for line in result_json.split("\n") if "test_name" in line ] cleaned_json = [ line.replace('"level": ?,', '"level": null,') for line in cleaned_json ] cleaned_json = "[" + ''.join(cleaned_json)[:-1] + "]" + cleaned_json = cleaned_json.replace("Binary", '"?"') j = json.loads(cleaned_json) for test_summary in j: if (test_summary["arch"], test_summary["branch"]) != (cibranch.arch, cibranch.branch): diff --git a/app/models/applists.py b/app/models/applists.py index b40c237..d6cb934 100644 --- a/app/models/applists.py +++ b/app/models/applists.py @@ -200,6 +200,9 @@ class Github(): def commit_date(self, app, sha): repo = app.repo.replace("https://github.com/", "") - github_date = self.request('repos/{}/commits/{}'.format(repo, sha))["commit"]["author"]["date"] + try: + github_date = self.request('repos/{}/commits/{}'.format(repo, sha))["commit"]["author"]["date"] + except: + import pdb; pdb.set_trace() parsed_date = datetime.datetime.strptime(github_date, "%Y-%m-%dT%H:%M:%SZ") return parsed_date diff --git a/app/models/unlistedapps.py b/app/models/unlistedapps.py index 415d544..b69bc42 100644 --- a/app/models/unlistedapps.py +++ b/app/models/unlistedapps.py @@ -28,12 +28,12 @@ class UnlistedApp(db.Model): community = json.loads(requests.get("https://raw.githubusercontent.com/YunoHost/apps/master/community.json").text) known_apps = set() - known_apps = known_apps.union([os.path.basename(app["url"]) for app in official.values() ]) - known_apps = known_apps.union([os.path.basename(app["url"]) for app in community.values() ]) + known_apps = known_apps.union([os.path.basename(app["url"]).lower() for app in official.values() ]) + known_apps = known_apps.union([os.path.basename(app["url"]).lower() for app in community.values() ]) apps = [] - for i in range(1,7): + for i in range(1,8): print("Page " + str(i) + " ... ") r = requests.get("https://api.github.com/search/repositories?q=_ynh&sort=updated&per_page=100&page="+str(i)) @@ -48,7 +48,7 @@ class UnlistedApp(db.Model): if not item["name"].endswith("_ynh"): continue - if item["name"] in known_apps: + if item["name"].lower() in known_apps: continue owner = item["owner"]["login"] diff --git a/app/templates/applist_history.html b/app/templates/applist_history.html index 3ad5d57..acfee90 100644 --- a/app/templates/applist_history.html +++ b/app/templates/applist_history.html @@ -36,7 +36,7 @@ window.onload = function () { shared: true }, data: [ - {% for level in range(8) %} + {% for level in range(7,-1,-1) %} { color: colors_per_level[{{ level }}], type: "stackedArea", diff --git a/app/templates/base.html b/app/templates/base.html index dfca194..2312c40 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -32,14 +32,14 @@