bats coverage fix
This commit is contained in:
@@ -7,8 +7,12 @@ REPORT_DIR="${2:-}"
|
||||
[ -n "$COVERAGE_VOLUME" ] || { echo "ERROR: coverage volume name required" >&2; exit 1; }
|
||||
[ -n "$REPORT_DIR" ] || { echo "ERROR: report directory required" >&2; exit 1; }
|
||||
|
||||
mkdir -p "$REPORT_DIR/coverage"
|
||||
docker run --rm -v "$COVERAGE_VOLUME":/coverage alpine tar c -C /coverage . | tar x -C "$REPORT_DIR/coverage"
|
||||
HAS_COVERAGE=false
|
||||
if docker run --rm -v "$COVERAGE_VOLUME":/coverage alpine sh -c '[ -d /coverage ] && ls -A /coverage | grep -q .' 2>/dev/null; then
|
||||
mkdir -p "$REPORT_DIR/coverage"
|
||||
docker run --rm -v "$COVERAGE_VOLUME":/coverage alpine tar c -C /coverage . | tar x -C "$REPORT_DIR/coverage"
|
||||
HAS_COVERAGE=true
|
||||
fi
|
||||
|
||||
cat > "$REPORT_DIR/index.html" << EOF
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8">
|
||||
@@ -19,7 +23,10 @@ h1{color:#1e293b}a{color:#2563eb;text-decoration:none}a:hover{text-decoration:un
|
||||
<h1>Bats report <code>${GITHUB_SHA:0:8}</code></h1>
|
||||
<ul>
|
||||
<li><a href="test-report.html">Test results</a></li>
|
||||
<li><a href="coverage/index.html">Coverage report</a></li>
|
||||
</ul>
|
||||
</body></html>
|
||||
EOF
|
||||
|
||||
if [ "$HAS_COVERAGE" = true ]; then
|
||||
echo '<li><a href="coverage/index.html">Coverage report</a></li>' >> "$REPORT_DIR/index.html"
|
||||
fi
|
||||
|
||||
echo '</ul></body></html>' >> "$REPORT_DIR/index.html"
|
||||
|
||||
Reference in New Issue
Block a user