Add prioritized testing page

This commit is contained in:
Matt Borgerson 2022-06-26 17:36:21 -07:00 committed by mborgerson
parent 9f78acb434
commit 1d686a2a8d
2 changed files with 119 additions and 14 deletions

View File

@ -43,16 +43,18 @@ def get_field(s,x):
return s[x] if x in s else ''
class Issue:
all_issues = []
issues_by_title = defaultdict(list)
all_issues = []
def __init__(self, number, url, title, affected_titles, created_at, updated_at):
def __init__(self, number, url, title, affected_titles, created_at, updated_at, closed_at, state):
self.number = number
self.url = url
self.title = title
self.affected_titles = affected_titles
self.created_at = created_at
self.updated_at = updated_at
self.closed_at = closed_at
self.state = state
def __repr__(self):
return self.title
@ -67,8 +69,7 @@ class Issue:
return
titles_re = re.compile(r'Titles?[:/]\s*([a-fA-f0-9,\s]+)', re.IGNORECASE)
title_id_re = re.compile(r'([a-fA-f0-9]{8})')
for issue in Github().get_user('mborgerson').get_repo('xemu').get_issues():
if issue.state != 'open': continue
for issue in Github().get_user('mborgerson').get_repo('xemu').get_issues(state='all'):
# Look for a titles sequence and pull out anything that looks like
# an id
references = ' '.join(titles_re.findall(issue.body or ''))
@ -78,8 +79,10 @@ class Issue:
issue.html_url,
issue.title,
affected_titles,
issue.created_at,
issue.updated_at))
issue.created_at.replace(tzinfo=timezone.utc),
issue.updated_at.replace(tzinfo=timezone.utc),
issue.closed_at.replace(tzinfo=timezone.utc) if issue.state == 'closed' else None,
issue.state))
# Organize issues by title
for issue in cls.all_issues:
@ -90,6 +93,7 @@ class Issue:
if issue not in cls.issues_by_title[title_alias_map[title_id]]:
cls.issues_by_title[title_alias_map[title_id]].append(issue)
class CompatibilityReport:
all_reports = []
reports_by_title = defaultdict(list)
@ -166,12 +170,6 @@ class Title:
self.xtimage_url = None
def process_compatibility(self):
# FIXME:
# - Only show reports for master branch
# - Sort by the build version that was tested, showing most recent
# builds first
# - Check version against repo for version numbers to filter out
# unofficial builds
self.compatibility_tests = CompatibilityReport.reports_by_title[self.full_title_id_hex]
if len(self.compatibility_tests) > 0:
self.most_recent_test = sorted(self.compatibility_tests, key=lambda x:x.info['created_at'])[-1]
@ -184,7 +182,22 @@ class Title:
@property
def issues(self):
return Issue.issues_by_title[self.info['title_id']]
"""
Open issues affecting this title.
"""
return [i for i in Issue.issues_by_title[self.info['title_id']]
if i.state == 'open']
@property
def recently_closed_issues(self):
"""
Issues affecting this game that were closed recently (since last report) and may impact playability status.
"""
if self.most_recent_test is None:
return []
return [i for i in Issue.issues_by_title[self.info['title_id']]
if i.state != 'open' and self.most_recent_test.created_at < i.closed_at]
def main():
env = Environment(loader=FileSystemLoader(searchpath='templates'))
@ -258,7 +271,7 @@ def main():
if disable_load_version:
xemu_build_tag = 'build-202106041913'
xemu_build_version = '0.5.2-26-g0a8e9b8db3'
xemu_build_version = '0.7.55'
xemu_build_date = datetime(2021, 6, 4, 19, 13, 6)
else:
xemu_build_version = requests.get('https://raw.githubusercontent.com/mborgerson/xemu/ppa-snapshot/XEMU_VERSION').text
@ -284,5 +297,30 @@ def main():
), minify_js=True, minify_css=True))
print(' - Ok')
print('Building testing priority table')
# Include titles that are either not Playable or have recently closed issues
def filter_(t):
if t.most_recent_test and t.most_recent_test.info['xemu_version'] == xemu_build_version:
return False # Up to date
if len(t.recently_closed_issues) > 0:
return True # Make sure the issues described are fixed
return t.status not in {'Playable', 'Perfect'}
def rank(t):
considered_playable = t.status in {'Playable', 'Perfect'}
have_recently_closed_issues = len(t.recently_closed_issues) > 0
ts = t.most_recent_test.created_at if t.most_recent_test else datetime.fromtimestamp(0, timezone.utc)
return (not have_recently_closed_issues, considered_playable, ts)
template = env.get_template('testing_priority.html')
with open(os.path.join(output_dir, 'testing_priority.html'), 'w') as f:
f.write(
minify_html(
template.render(
titles=sorted([t for t in titles if filter_(t)], key=rank)),
minify_js=True, minify_css=True))
print(' - Ok')
if __name__ == '__main__':
main()

View File

@ -0,0 +1,67 @@
{% set title_status_colors = {'Unknown' : '#595959', 'Broken' : '#D7263D', 'Intro' : '#F86624', 'Starts' : '#FF9800', 'Playable' : '#42e335', 'Perfect' : '#1bdeff'} %}
{% extends "template_base.html" %}
{% block title %}Compatibility Priority Testing List{% endblock %}
{% block append_head %}
<style type="text/css">
.playability-tag {
display: inline-block;
font-weight: 400;
text-align: center;
vertical-align: middle;
padding: .375rem .75rem;
font-size: .9375rem;
line-height: 1.5;
border-radius: .25rem;
}
{% for status in title_status_colors %}
.playability-tag-{{ status }} {
color: {{ title_status_colors[status] }};
border: 1px solid {{ title_status_colors[status] }};
}
{% endfor %}
.table td {
vertical-align: middle !important;
}
</style>
{% endblock %}
{% block content %}
<div class="pt-5">
<h1>Compatibilty Testing Priority List</h1>
<p>
The following list of titles have an issue closed since the last evaluation, or have not been evaluated recently, and should receive priority testing.
</p>
</div>
<table class="table">
<thead>
<tr>
<th scope="col">Title</th>
<th scope="col">Last Updated</th>
<th scope="col">Recently Closed Issues</th>
<th scope="col">Current Status</th>
</tr>
</thead>
<tbody>
{% for title in titles %}
<tr>
<td><a href="{{ title.title_url }}">{{ title.title_name }}</a></td>
{% if title.most_recent_test %}
<td>{{ title.most_recent_test.created_at.strftime('%b %-d, %Y') }}</td>
{% else %}
<td>Never</td>
{% endif %}
<td>
{% for issue in title.recently_closed_issues %}
<a href="{{ issue.url }}" title="{{ issue.title|e }}">#{{ issue.number }}</a>
{% endfor %}
</td>
<td><span class="playability-tag playability-tag-{{ title.status }}">{{ title.status }}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}