{% macro pipeline(directory, name) %}

{{ name }}

{% set_global latest = [] %} {% set_global data = [] %} {% for impl in config.extra.tests.pipelines[name].impl %} {# Don't forget to trim() to remove confusing trailing newline #} {# First check if data exists before concatenating #} {% set loaded = load_data(path="static/"~config.extra.tests.directory~"/"~impl.name~"/latest", required=false) %} {% if loaded %}{% set_global latest = latest | concat(with=loaded|trim()) %}{% endif %} {% set loaded = load_data(path="static/"~config.extra.tests.directory~"/"~impl.name~"/results.toml", required=false) %} {% if loaded %}{% set_global data = data | concat(with=loaded) %}{% endif %} {% endfor %} {% if data and latest %} {% for impl in config.extra.tests.pipelines[name].impl %} {% endfor %} {% for testname, result in data | first | get(key=latest[0]) %} {% for impl in config.extra.tests.pipelines[name].impl %} {% set lastrun = latest[loop.index0] %} {% endfor %} {% endfor %}
Test{{ impl.name }}
{{ latest[loop.index0] | split(pat="-") | nth(n=0) | int | date(format=widgets::t(key="dateFormat", lang=lang)) }}
{{ testname }} {{ data[loop.index0][lastrun][testname] }}
{% for impl in config.extra.tests.pipelines[name].impl %} {% set suite_index = loop.index0 %}

{{ impl.name }}

{# 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="-") %}
{{ date_commit[0] | int | date(format=widgets::t(key="dateFormat", lang=lang)) }} (commit {% if config.extra.tests.commiturls %}{{ date_commit[1] }}{% else %}{{ date_commit[1] }}{% endif %})
{% endfor %} {% endfor %} {% else %} {% set impls = config.extra.tests.pipelines[name].impl|map(attribute="name")|join(sep=",") %}{% set impls = "{" ~ impls ~ "}" %}

No test data to display from "static/{{ config.extra.tests.directory }}/{{ impls }}/{latest,results.toml}.

{% endif %} {% endmacro pipeline %}