Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract common partials from report and history templates #1745

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions conf/report/history-graph-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.5.0/dist/chart.min.js"></script>
<link rel="stylesheet" type="text/css" href="history.css">
</head>

<body>
<button class="button-switcher button-switcher-history" onclick="location='https://chipsalliance.github.io/sv-tests-results/history'"> sv-tests results history </button>
<button class="button-switcher" onclick="location='https://chipsalliance.github.io/sv-tests-results/'"> sv-tests results </button>
<canvas id="line-chart" width=300" height="150"></canvas>
<script>

Expand Down
17 changes: 17 additions & 0 deletions conf/report/history.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.button-switcher {
background-color: white;
color: black;
border: 2px solid #4CAF60;
border-radius: 5px;
top: 10px;
font-size: auto;
float: right;
margin:5px;
}

.button-switcher-history {background-color: #4CAF60; color: white;}

.button-switcher:hover {
background-color: #4CAF60;
color: white;
}
5 changes: 5 additions & 0 deletions conf/report/partials/body-begin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% if False %}
<!-- vim: set ts=2 sts=2 sw=2 et: -->
{% endif %}
</head>
<body>
4 changes: 4 additions & 0 deletions conf/report/partials/body-end.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% if False %}
<!-- vim: set ts=2 sts=2 sw=2 et: -->
{% endif %}
</body>
8 changes: 8 additions & 0 deletions conf/report/partials/content-begin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% if False %}
<!-- vim: set ts=2 sts=2 sw=2 et: -->
{% endif %}
<button class="button-switcher" onclick="location='https://chipsalliance.github.io/sv-tests-results/history'"> sv-tests results history </button>
<button class="button-switcher button-switcher-report" onclick="location='https://chipsalliance.github.io/sv-tests-results/'"> sv-tests results </button>
<br>
<h1 class="headline"><a href="https://github.com/chipsalliance/sv-tests">SV-Tests</a></h1>
<p class="headline"><a href="https://github.com/chipsalliance/sv-tests"><em>Test suite to check compliance with the SystemVerilog LRM by chapter as well as some real-world cores and test-cases.</em></a></p>
18 changes: 18 additions & 0 deletions conf/report/partials/content-end.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% if False %}
<!-- vim: set ts=2 sts=2 sw=2 et: -->
{% endif %}
<br>
<a class="download" href="report.csv">Download a summary in csv</a>

<br> <br>
<footer id="footer">
Generated using <a href="https://github.com/chipsalliance/sv-tests">sv-tests</a>,
revision: <a href="https://github.com/chipsalliance/sv-tests/commit/{{revision}}">{{revision}}</a>,
{% if build_id != 'local' %}
{% set href = 'https://github.com/chipsalliance/sv-tests/actions/runs/' ~ build_id|string %}
build_id: <a href="{{href}}">{{build_id}}</a>,
{% else %}
build_id: <a>{{build_id}}</a>,
{% endif %}
date: <a>{{datetime}}</a>.
</footer>
9 changes: 9 additions & 0 deletions conf/report/partials/page-begin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% if False %}
<!-- vim: set ts=2 sts=2 sw=2 et: -->
{% endif %}
<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8" />
<title>{{ title }}</title>
4 changes: 4 additions & 0 deletions conf/report/partials/page-end.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% if False %}
<!-- vim: set ts=2 sts=2 sw=2 et: -->
{% endif %}
</html>
42 changes: 12 additions & 30 deletions conf/report/report-template.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{% if False %}
<!-- vim: set ts=2 sts=2 sw=2 et: -->
{% endif %}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>SystemVerilog Report</title>

{% include "page-begin.html" %}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
Expand All @@ -18,9 +15,8 @@
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet"/>
<link rel="stylesheet" type="text/css" href="report.css">
<script type="text/javascript" charset="utf8" src="report.js"></script>
</head>

<script>

<script>
var table;
var toolnames = [];
var tool_array = [];
Expand Down Expand Up @@ -371,10 +367,9 @@
width: calc(80% / {{ report.keys()|length}} );
}
</style>

<body>
<h1 class="headline"><a href="https://github.com/chipsalliance/sv-tests">SV-Tests</a></h1>
<p class="headline"><a href="https://github.com/chipsalliance/sv-tests"><em>Test suite to check compliance with the SystemVerilog LRM by chapter as well as some real-world cores and test-cases.</em></a></p>
{% include 'body-begin.html' %}
{% include "content-begin.html" %}

<button onclick="toggleFilters()">Show advanced filters (experimental)</button>
<section style="display: none;" id="filter">
<ul class="filter-entries">
Expand Down Expand Up @@ -483,23 +478,10 @@ <h1 class="headline"><a href="https://github.com/chipsalliance/sv-tests">SV-Test
</tr>
</tfoot>
</table>
<br>
<a class="download" href="report.csv">Download a summary in csv</a>
</body>

<br> <br>
<footer id="footer">
Generated using <a href="https://github.com/chipsalliance/sv-tests">sv-tests</a>,
revision: <a href="https://github.com/chipsalliance/sv-tests/commit/{{revision}}">{{revision}}</a>,
{% if build_id != 'local' %}
{% set href = 'https://github.com/chipsalliance/sv-tests/actions/runs/' ~ build_id|string %}
build_id: <a href="{{href}}">{{build_id}}</a>,
{% else %}
build_id: <a>{{build_id}}</a>,
{% endif %}
date: <a>{{datetime}}</a>.
</footer>


{% include 'content-end.html' %}
{% include 'body-end.html' %}

<div id="logfile-outer">
<div class="iframe-wrap">
<iframe class="iframe-log" name="log-frame"></iframe>
Expand Down Expand Up @@ -540,4 +522,4 @@ <h1 class="headline"><a href="https://github.com/chipsalliance/sv-tests">SV-Test
{% endfor %}
</div>

</html>
{% include 'page-end.html' %}
19 changes: 19 additions & 0 deletions conf/report/report.css
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,25 @@ button:focus {outline:0;}
left: 0;
}

.button-switcher {
background-color: white;
color: black;
border: 2px solid #4CAF60;
border-radius: 5px;
top: 10px;
font-size: 20px;
position:relative;
float: right;
margin:5px;
}

.button-switcher-report {background-color: #4CAF60; color: white;}

.button-switcher:hover {
background-color: #4CAF60;
color: white;
}

footer {
text-align: center;
font-size: 10px;
Expand Down
13 changes: 11 additions & 2 deletions tools/sv-report
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ parser.add_argument(
help="Path to the html report template",
default="conf/report/report-template.html")

parser.add_argument(
"--partials",
help="Directory with report template partials",
default="conf/report/partials/")

parser.add_argument(
"--code-template",
help="Path to the html code preview template",
Expand Down Expand Up @@ -559,8 +564,10 @@ try:
1 for t in rtt if rtt[t]["status"] not in "test-na")

with open(args.template, "r") as f:
report = jinja2.Template(
f.read(), trim_blocks=True, lstrip_blocks=True)
loader = jinja2.FileSystemLoader(args.partials)
report = jinja2.Environment(
loader=loader, trim_blocks=True,
lstrip_blocks=True).from_string(f.read())

build_id = os.environ.get('GITHUB_RUN_ID', 'local')
build_datetime = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
Expand All @@ -571,6 +578,8 @@ try:
report=data,
database=database,
database_urls=urls,
#Partials
title="SystemVerilog Report",
revision=args.revision,
build_id=build_id,
datetime=build_datetime))
Expand Down