| 1 |
{% extends "base.html" %} |
| 2 |
{% import "repo_tabs.html" as m %} |
| 3 |
{% block title %}Coverage · {{ repo.owner }}/{{ repo.name }}{% endblock %} |
| 4 |
{% block tabs %}{% call m::tabs(repo, "coverage") %}{% endblock %} |
| 5 |
{% block content %} |
| 6 |
<div class="head"><h1>Coverage <small>of {{ bookmark }}</small></h1></div> |
| 7 |
{% if let Some(r) = report %} |
| 8 |
<section class="cov-summary"> |
| 9 |
<div class="cov-big {{ self.class_of(r.percent()) }}">{{ self.pct(r.percent()) }}{% if let Some(d) = self.delta_text() %} <span class="cov-delta" title="Against the run before it on {{ bookmark }}">{{ d }}</span>{% endif %}</div> |
| 10 |
<dl class="facts"> |
| 11 |
<dt>Lines</dt><dd>{{ r.lines_hit }} of {{ r.lines_found }} run</dd> |
| 12 |
{% if r.functions_found > 0 %}<dt>Functions</dt><dd>{{ self.pct(r.functions_percent()) }} ({{ r.functions_hit }} of {{ r.functions_found }})</dd>{% endif %} |
| 13 |
{% if r.branches_found > 0 %}<dt>Branches</dt><dd>{{ self.pct(r.branches_percent()) }} ({{ r.branches_hit }} of {{ r.branches_found }})</dd>{% endif %} |
| 14 |
<dt>From</dt><dd><a href="{{ repo.url }}/flow/{{ r.run_number }}">run #{{ r.run_number }}</a>, job {{ r.job }}, <time title="{{ r.created_ms|when_i }}">{{ r.created_ms|ago_i }}</time></dd> |
| 15 |
<dt>Files</dt><dd>{{ r.files }}{% if r.dropped > 0 %} <span class="mute small">({{ r.dropped }} named in the report are not in this state and are left out)</span>{% endif %}</dd> |
| 16 |
<dt>Badge</dt><dd><img src="{{ repo.url }}/coverage/badge.svg" alt="coverage badge"> <code class="small">[]({{ shell.base_url }}{{ repo.url }}/coverage)</code></dd> |
| 17 |
</dl> |
| 18 |
</section> |
| 19 |
{% if !trend.is_empty() %}<section class="panel"><h2>The last {{ runs }} runs</h2>{{ trend|safe }}</section>{% endif %} |
| 20 |
<section class="panel"> |
| 21 |
<h2>Files <small class="mute">sorted by {% if sort == "missed" %}lines missed{% else if sort == "percent" %}coverage, lowest first{% else %}path{% endif %}: |
| 22 |
{% if sort != "missed" %}<a href="?report={{ r.id }}&sort=missed">lines missed</a> {% endif %}{% if sort != "percent" %}<a href="?report={{ r.id }}&sort=percent">lowest first</a> {% endif %}{% if sort != "path" %}<a href="?report={{ r.id }}&sort=path">path</a>{% endif %}</small></h2> |
| 23 |
<div class="table"><table class="cov-files"> |
| 24 |
<tr><th>File</th><th>Coverage</th><th class="num">Lines</th><th class="num">Missed</th></tr> |
| 25 |
{% for f in files %}<tr> |
| 26 |
<td><a href="{{ repo.url }}/coverage/{{ r.id }}/file/{{ f.path }}">{{ f.path }}</a></td> |
| 27 |
<td><span class="cov-bar {{ self.class_of(f.percent()) }}" role="img" aria-label="{{ self.pct(f.percent()) }}"><span style="width: {% if let Some(p) = f.percent() %}{{ p }}{% else %}0{% endif %}%"></span></span> {{ self.pct(f.percent()) }}</td> |
| 28 |
<td class="num">{{ f.lines_found }}</td> |
| 29 |
<td class="num">{{ f.missed() }}</td> |
| 30 |
</tr>{% endfor %} |
| 31 |
</table></div> |
| 32 |
</section> |
| 33 |
{% else %} |
| 34 |
<section class="panel"> |
| 35 |
<p>No coverage report for <strong>{{ bookmark }}</strong> yet.</p> |
| 36 |
<p>Give a job in <code>.flow/pipeline.kdl</code> an artifact named <code>coverage</code> holding an LCOV report, and the hub reads it when the job uploads it. For Rust:</p> |
| 37 |
<pre>job "coverage" { |
| 38 |
sandbox "rust" |
| 39 |
exec "cargo" "llvm-cov" "--workspace" "--lcov" "--output-path" "/src/target/lcov.info" |
| 40 |
output { |
| 41 |
artifact "coverage" { path "/src/target/lcov.info" } |
| 42 |
} |
| 43 |
}</pre> |
| 44 |
<p class="small mute">Istanbul (<code>--reporter=lcov</code>), coverage.py (<code>coverage lcov</code>) and gcov with lcov write LCOV too. Paths are read relative to the job's <code>/src</code>.</p> |
| 45 |
</section> |
| 46 |
{% endif %} |
| 47 |
{% endblock %} |