Feature/yksinkertaistetaan raportointi logiikkaa #22

Merged
niko merged 12 commits from feature/yksinkertaistetaan-raportointi-logiikkaa into main 2026-06-18 12:55:02 +03:00
Showing only changes of commit 11ca47cf1b - Show all commits
+10 -12
View File
@@ -17,18 +17,16 @@ if [ ! -d "$REPORT_DIR" ]; then
exit 1
fi
cd "$REPORT_DIR"
FILES=()
while IFS= read -r -d '' f; do
FILES+=("$(basename "$f")")
done < <(find . -maxdepth 1 -type f ! -name index.html -print0 2>/dev/null || true)
done < <(find "$REPORT_DIR" -maxdepth 1 -type f ! -name index.html -print0 2>/dev/null || true)
SUBDIRS=()
while IFS= read -r -d '' d; do
name="${d#./}"
[ -f "$name/index.html" ] && SUBDIRS+=("$name")
done < <(find . -maxdepth 1 -type d ! -name . -print0 2>/dev/null || true)
name="${d#$REPORT_DIR/}"
[ -f "$d/index.html" ] && SUBDIRS+=("$name")
done < <(find "$REPORT_DIR" -maxdepth 1 -type d ! -name . -print0 2>/dev/null || true)
TOTAL=$(( ${#FILES[@]} + ${#SUBDIRS[@]} ))
@@ -61,26 +59,26 @@ generate_index() {
html+="<li><a href=\"$d/index.html\">${d^}</a></li>"
done
html+='</ul></body></html>'
printf '%s' "$html" > index.html
printf '%s' "$html" > "$REPORT_DIR/index.html"
}
cd - > /dev/null
# Stage reports for backward-compatible publish
STAGED="reports/${SHA8}/${SUITE}"
mkdir -p "$STAGED"
cp -a "$REPORT_DIR/." "$STAGED/"
if [ "$TOTAL" -eq 1 ]; then
cp -a "$REPORT_DIR/." "$STAGED/"
bash .ci/scripts/publish-git-pages.sh "$SUITE"
if [ ${#FILES[@]} -eq 1 ]; then
ENTRY="${FILES[0]}"
else
ENTRY="${SUBDIRS[0]}/index.html"
fi
bash .ci/scripts/publish-git-pages.sh "$SUITE"
URL="${GIT_PAGES_URL}/${GITHUB_REPOSITORY}/reports/${SHA8}/${SUITE}/${ENTRY}"
bash .ci/scripts/report-status.sh success "$DESCRIPTION" "$CONTEXT" "" "$URL"
else
generate_index
cp -a "$REPORT_DIR/." "$STAGED/"
bash .ci/scripts/publish-git-pages.sh "$SUITE"
bash .ci/scripts/report-status.sh success "$DESCRIPTION" "$CONTEXT" "$SUITE"
fi