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

add link back to main page in coverage report html #13

Merged
merged 1 commit into from
Nov 28, 2024
Merged
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
17 changes: 16 additions & 1 deletion coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,23 @@ total_line_coverage=$(grep -E "lines" "${build_dir}/coverage_summary.txt" | awk
echo "{\"total_line_coverage\": \"$total_line_coverage\"}" > "${build_dir}/coverage_summary.json"

echo "generate coverage report:"

html_prolog="${build_dir}/coverage_report_prolog.html"
rm -f $html_prolog

echo '<html lang="en">' >> $html_prolog
echo '<head>' >> $html_prolog
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">' >> $html_prolog
echo '<title>TempDir - @pagetitle@</title>' >> $html_prolog
echo '<link rel="stylesheet" type="text/css" href="@[email protected]">' >> $html_prolog
echo '</head>' >> $html_prolog
echo '<body>' >> $html_prolog
echo '<h1 style="font-family:sans-serif;text-align:center;">' >> $html_prolog
echo '<a href="../@basedir@">TempDir</a>: Simplified Temporary Directory for C++' >> $html_prolog
echo '</h1><hr/>' >> $html_prolog

rm -Rf "${build_dir}/coverage_report"
genhtml "${build_dir}/filtered_coverage.info" --output-directory "${build_dir}/coverage_report"
genhtml "${build_dir}/filtered_coverage.info" -o "${build_dir}/coverage_report" --html-prolog "${build_dir}/coverage_report_prolog.html"

echo "download coverage badge"
curl -o "${build_dir}/coverage_report/badge.svg" "https://img.shields.io/badge/coverage-${total_line_coverage}25-rgb%2850,201,85%29"