diff --git a/.gitmodules b/.gitmodules index c8266f7..ec329ec 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "themes/water"] path = themes/water url = https://tildegit.org/southerntofu/zola-water +[submodule "submodules/endpoints"] + path = submodules/endpoints + url = https://tildegit.org/forge/endpoints diff --git a/config.toml b/config.toml index ecc7243..4207cb2 100644 --- a/config.toml +++ b/config.toml @@ -43,6 +43,15 @@ suites = [ "forgebuild.sh", "forgebuild.rs" ] number = 3 # Repositories the commits originate from commiturls = [ "https://tildegit.org/forge/build.sh/commit/", "https://tildegit.org/forge/build.rs/commit/" ] +[extra.tests.pipelines.forgebuild] +repo = "https://tildegit.org/forge/build" +url = "https://tildegit.org/forge/build/commit/$id" +impl = [ { "name" = "forgebuild.sh", "repo" = "https://tildegit.org/forge/build.sh", "url" = "https://tildegit.org/forge/build.sh/commit/$id" }, + { "name" = "forgebuild.rs", "repo" = "https://tildegit.org/forge/build.rs", "url" = "https://tildegit.org/forge/build.rs/commit/$id" } ] +[extra.tests.pipelines.endpoints] +repo = "https://tildegit.org/forge/endpoints" +url = "https://tildegit.org/forge/endpoints/commit/$id" +impl = [ { "name" = "endpoints.php", "repo" = "https://tildegit.org/forge/endpoints.php", url = "https://tildegit.org/forge/endpoints.php/commit/$id" } ] [translations] [translations.fr] diff --git a/content/_common/menu.fr.md b/content/_common/menu.fr.md index 9861d08..931fe5e 100644 --- a/content/_common/menu.fr.md +++ b/content/_common/menu.fr.md @@ -9,6 +9,10 @@ --- +[endpoints](@/endpoints.fr.md) + +--- + forgehook --- diff --git a/content/_common/menu.md b/content/_common/menu.md index 85783fc..5969bc3 100644 --- a/content/_common/menu.md +++ b/content/_common/menu.md @@ -9,6 +9,10 @@ --- +[endpoints](@/endpoints.md) + +--- + forgehook --- diff --git a/content/endpoints.fr.md b/content/endpoints.fr.md new file mode 120000 index 0000000..7f5e871 --- /dev/null +++ b/content/endpoints.fr.md @@ -0,0 +1 @@ +../submodules/endpoints/README.md \ No newline at end of file diff --git a/content/endpoints.md b/content/endpoints.md new file mode 120000 index 0000000..7f5e871 --- /dev/null +++ b/content/endpoints.md @@ -0,0 +1 @@ +../submodules/endpoints/README.md \ No newline at end of file diff --git a/submodules/build b/submodules/build index 71b77d9..ec018c8 160000 --- a/submodules/build +++ b/submodules/build @@ -1 +1 @@ -Subproject commit 71b77d90df574aac98c4383ed50a8799fbfd5895 +Subproject commit ec018c892fdec76437bd5a500009464c20accef7 diff --git a/submodules/endpoints b/submodules/endpoints new file mode 160000 index 0000000..304fd94 --- /dev/null +++ b/submodules/endpoints @@ -0,0 +1 @@ +Subproject commit 304fd9429d8c70452e6bf0276144005fcf925034 diff --git a/templates/project.html b/templates/project.html new file mode 100644 index 0000000..049ec78 --- /dev/null +++ b/templates/project.html @@ -0,0 +1,11 @@ +{% extends 'page.html' %}{% import "tests.html" as tests %} +{% block main %} + {{ super() }} + {% if page.extra.pipeline %} + {% if page.extra.pipeline in config.extra.tests.pipelines %} + {{ tests::pipeline(directory=config.extra.tests.directory, name=page.extra.pipeline) }} + {% else %} +

No such pipeline ({{ page.extra.pipeline }}) defined in config.extra.pipelines

+ {% endif %} + {% endif %} +{% endblock %} diff --git a/templates/status.html b/templates/status.html index 4f69783..62c2225 100644 --- a/templates/status.html +++ b/templates/status.html @@ -1,60 +1,7 @@ -{% extends "index.html" %} +{% extends "index.html" %}{% import "tests.html" as tests %} {% block title %}{{ page.title }}{% endblock title %} {% block main %} -

forgebuild

-{% set latest = [] %} -{% 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/"~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 config.extra.tests.suites %} - -{% endfor %} - - - {% for testname, result in data | first | get(key=latest[0]) %} - - - {% for suite in config.extra.tests.suites %} - {% set lastrun = latest[loop.index0] %} - - {% endfor %} - - {% 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 config.extra.tests.suites %} - {% set suite_index = loop.index0 %} - -

{{ suite }}

- {# 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=trans(key="dateFormat", lang=lang)) }} (commit {% if config.extra.tests.commiturls %}{{ date_commit[1] }}{% else %}{{ date_commit[1] }}{% endif %}) - -
- {% endfor %} +{% for pipeline_name, _ in config.extra.tests.pipelines %} +{{ tests::pipeline(directory=config.extra.tests.directory, name=pipeline_name) }} {% endfor %} {% endblock main %} diff --git a/templates/tests.html b/templates/tests.html new file mode 100644 index 0000000..53d23b6 --- /dev/null +++ b/templates/tests.html @@ -0,0 +1,58 @@ +{% macro pipeline(directory, name) %} +

{{ name }}

+{% 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 %} + + + + + {% 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=trans(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=trans(key="dateFormat", lang=lang)) }} (commit {% if config.extra.tests.commiturls %}{{ date_commit[1] }}{% else %}{{ date_commit[1] }}{% endif %}) + +
+ {% endfor %} +{% endfor %} +{% endmacro pipeline %}