diff --git a/config.toml b/config.toml index dcd4cdb..ecc7243 100644 --- a/config.toml +++ b/config.toml @@ -33,6 +33,17 @@ home = "https://tildegit.org/" # Name of the forge name = "tildegit" +[extra.tests] +# Where to find tests results ($directory/$suite/results.toml) +# Path from static/ directory, no trailing / +directory = "tests" +# If there are several test suites, declare them here +suites = [ "forgebuild.sh", "forgebuild.rs" ] +# The number of latest runs to display +number = 3 +# Repositories the commits originate from +commiturls = [ "https://tildegit.org/forge/build.sh/commit/", "https://tildegit.org/forge/build.rs/commit/" ] + [translations] [translations.fr] source = "Source de cette page" diff --git a/templates/status.html b/templates/status.html index 4624fe5..4f69783 100644 --- a/templates/status.html +++ b/templates/status.html @@ -2,23 +2,18 @@ {% block title %}{{ page.title }}{% endblock title %} {% block main %}

forgebuild

-{% set suites = [ "forgebuild.sh", "forgebuild.rs" ] %} -{% set directory = "tests" %} -{% set bash_data = load_data(path="static/"~directory~"/forgebuild.sh/results.toml") %} -{% set bash_latest = load_data(path="static/"~directory~"/forgebuild.sh/latest") %} -{% set rust_data = load_data(path="static/tests/forgebuild.rs/results.toml") %} {% set latest = [] %} -{% set_global data = [] %} -{% for suite in suites %} +{% set data = [] %} +{% for suite in config.extra.tests.suites %} {# Don't forget to trim() to remove confusing trailing newline #} -{% set_global latest = latest | concat(with=load_data(path="static/"~directory~"/"~suite~"/latest")|trim()) %} -{% set_global data = data | concat(with=load_data(path="static/"~directory~"/"~suite~"/results.toml")) %} +{% set_global latest = latest | concat(with=load_data(path="static/"~config.extra.tests.directory~"/"~suite~"/latest")|trim()) %} +{% set_global data = data | concat(with=load_data(path="static/"~config.extra.tests.directory~"/"~suite~"/results.toml")) %} {% endfor %} -{% for suite in suites %} +{% for suite in config.extra.tests.suites %} @@ -28,10 +23,10 @@ {% for testname, result in data | first | get(key=latest[0]) %} - {% for suite in suites %} + {% for suite in config.extra.tests.suites %} {% set lastrun = latest[loop.index0] %} @@ -40,7 +35,7 @@ {% endfor %}
Test{{ suite }}
{{ latest[loop.index0] | split(pat="-") | nth(n=0) | int | date(format=trans(key="dateFormat", lang=lang)) }}
{{ testname }} - + {{ data[loop.index0][lastrun][testname] }}
-{% for suite in suites %} +{% for suite in config.extra.tests.suites %} {% set suite_index = loop.index0 %}

{{ suite }}

@@ -50,10 +45,10 @@ {% for run in runs | reverse %} {# TODO: configure in config.extra how many commits to display #} - {% if loop.index > 2 %}{% break %}{% endif %} + {% if loop.index > config.extra.tests.number|default(value=10) %}{% break %}{% endif %} {% set date_commit = run | split(pat="-") %}
- {{ date_commit[0] | int | date(format=trans(key="dateFormat", lang=lang)) }} ({{ date_commit[1] }}) + {{ date_commit[0] | int | date(format=trans(key="dateFormat", lang=lang)) }} (commit {% if config.extra.tests.commiturls %}{{ date_commit[1] }}{% else %}{{ date_commit[1] }}{% endif %})