coverage report fix
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 2m12s
acc-tests Link to Cucumber reports
CI Feature / Cucumber tests (push) Successful in 2m15s
unit-tests Link to Bats reports
CI Feature / Bats tests (push) Successful in 2m34s
CI Feature / Report Summary (push) Successful in 5s
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 2m12s
acc-tests Link to Cucumber reports
CI Feature / Cucumber tests (push) Successful in 2m15s
unit-tests Link to Bats reports
CI Feature / Bats tests (push) Successful in 2m34s
CI Feature / Report Summary (push) Successful in 5s
This commit is contained in:
@@ -5,7 +5,26 @@ REPORT_DIR="${1:-}"
|
||||
|
||||
[ -n "$REPORT_DIR" ] || { echo "ERROR: report directory required" >&2; exit 1; }
|
||||
|
||||
COVERAGE_DIR="$REPORT_DIR/coverage"
|
||||
|
||||
if [ -d coverage ]; then
|
||||
mkdir -p "$REPORT_DIR/coverage"
|
||||
cp -a coverage/. "$REPORT_DIR/coverage/"
|
||||
mkdir -p "$COVERAGE_DIR"
|
||||
cp -a coverage/. "$COVERAGE_DIR/"
|
||||
fi
|
||||
|
||||
if [ -d "$COVERAGE_DIR" ] && [ ! -f "$COVERAGE_DIR/index.html" ]; then
|
||||
SHA8="${GITHUB_SHA:0:8}"
|
||||
{
|
||||
echo '<!DOCTYPE html><html lang="en"><head><meta charset="utf-8">'
|
||||
echo "<title>Coverage report ${SHA8}</title>"
|
||||
echo '<style>body{font-family:sans-serif;margin:2em}h1{color:#1e293b}ul{list-style:none;padding:0}li{margin:.5em 0}a{color:#2563eb}</style>'
|
||||
echo "</head><body><h1>Coverage report <code>${SHA8}</code></h1><ul>"
|
||||
while IFS= read -r -d '' f; do
|
||||
base=$(basename "$f")
|
||||
name="${base%.*}"
|
||||
name="${name//-/ }"
|
||||
echo "<li><a href=\"${base}\">${name^}</a></li>"
|
||||
done < <(find "$COVERAGE_DIR" -maxdepth 1 -type f \( -name '*.html' -o -name '*.txt' \) ! -name index.html -print0 2>/dev/null || true)
|
||||
echo '</ul></body></html>'
|
||||
} > "$COVERAGE_DIR/index.html"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user