site/templates/tests.html

59 lines
2.5 KiB
HTML

{% macro pipeline(directory, name) %}
<h2 id="{{ name }}">{{ name }}</h2>
{% set latest = [] %}
{% set data = [] %}
{% for impl in config.extra.tests.pipelines[name].impl %}
{# Don't forget to trim() to remove confusing trailing newline #}
{% set_global latest = latest | concat(with=load_data(path="static/"~config.extra.tests.directory~"/"~impl.name~"/latest")|trim()) %}
{% set_global data = data | concat(with=load_data(path="static/"~config.extra.tests.directory~"/"~impl.name~"/results.toml")) %}
{% endfor %}
<table>
<tr>
<th>Test</th>
{% for impl in config.extra.tests.pipelines[name].impl %}
<th>{{ impl.name }}
<br>{{ latest[loop.index0] | split(pat="-") | nth(n=0) | int | date(format=trans(key="dateFormat", lang=lang)) }}
</th>
{% endfor %}
</tr>
{% for testname, result in data | first | get(key=latest[0]) %}
<tr>
<td>{{ testname }}</td>
{% for impl in config.extra.tests.pipelines[name].impl %}
{% set lastrun = latest[loop.index0] %}
<td>
<a href="{{ get_url(path=config.extra.tests.directory~"/"~impl.name~"/"~lastrun|split(pat="-")|nth(n=0)) }}">
{{ data[loop.index0][lastrun][testname] }}
</a>
</td>
{% endfor %}
</tr>
{% endfor %}
</table>
{% for impl in config.extra.tests.pipelines[name].impl %}
{% set suite_index = loop.index0 %}
<h3>{{ impl.name }}</h3>
{# This is a hack because we can't reverse a map (only arrays) #}
{% set_global runs = [] %}
{% for key, val in data[suite_index] %}{% set_global runs = runs | concat(with=key) %}{% endfor %}
{% for run in runs | reverse %}
{# TODO: configure in config.extra how many commits to display #}
{% if loop.index > config.extra.tests.number|default(value=10) %}{% break %}{% endif %}
{% set date_commit = run | split(pat="-") %}
<details class="testrun">
<summary><a href="{{ get_url(path=config.extra.tests.directory~"/"~impl.name~"/" ~ date_commit.0) }}">{{ date_commit[0] | int | date(format=trans(key="dateFormat", lang=lang)) }}</a> (commit {% if config.extra.tests.commiturls %}<a href="{{ config.extra.tests.commiturls[suite_index] }}{{ date_commit[1] }}">{{ date_commit[1] }}</a>{% else %}{{ date_commit[1] }}{% endif %})</summary>
<ul>
{% for testname, result in data[suite_index][run] %}
<li>{{ result }} {{ testname }}</li>
{% endfor %}
</ul>
</details>
{% endfor %}
{% endfor %}
{% endmacro pipeline %}