Fix/git pages gitea reports 1 #49

Merged
niko merged 2 commits from fix/git-pages-gitea-reports-1 into main 2026-06-28 09:25:41 +03:00
3 changed files with 19 additions and 6 deletions
Showing only changes of commit beef556556 - Show all commits
+4 -5
View File
@@ -81,11 +81,10 @@ generate_index() {
} > "$REPORT_DIR/index.html" } > "$REPORT_DIR/index.html"
} }
STAGED="reports/${SHA8}/${SUITE}" mkdir -p "$SUITE"
mkdir -p "$STAGED"
if [ "$TOTAL" -eq 1 ]; then if [ "$TOTAL" -eq 1 ]; then
cp -a "$REPORT_DIR/." "$STAGED/" cp -a "$REPORT_DIR/." "$SUITE/"
sh .ci/scripts/publish-git-pages.sh "$SUITE" sh .ci/scripts/publish-git-pages.sh "$SUITE"
first_entry=$(echo "$ENTRIES" | head -1) first_entry=$(echo "$ENTRIES" | head -1)
@@ -102,9 +101,9 @@ if [ "$TOTAL" -eq 1 ]; then
sh .ci/scripts/report-status.sh "$STATUS" "$DESCRIPTION" "$CONTEXT" "" "$URL" sh .ci/scripts/report-status.sh "$STATUS" "$DESCRIPTION" "$CONTEXT" "" "$URL"
else else
generate_index generate_index
cp -a "$REPORT_DIR/." "$STAGED/" cp -a "$REPORT_DIR/." "$SUITE/"
sh .ci/scripts/publish-git-pages.sh "$SUITE" sh .ci/scripts/publish-git-pages.sh "$SUITE"
sh .ci/scripts/report-status.sh "$STATUS" "$DESCRIPTION" "$CONTEXT" "$SUITE" sh .ci/scripts/report-status.sh "$STATUS" "$DESCRIPTION" "$CONTEXT" "$SUITE"
fi fi
rm -rf "$STAGED" rm -rf "$SUITE"
+6
View File
@@ -19,6 +19,12 @@ PAGES_USER="${GIT_PAGES_PUBLISH_USER:-publish}"
[ -d "$SUITE" ] || { echo "ERROR: not a directory: $SUITE" >&2; exit 1; } [ -d "$SUITE" ] || { echo "ERROR: not a directory: $SUITE" >&2; exit 1; }
EMPTY=1
for _f in "$SUITE"/* "$SUITE"/.*; do
[ -e "$_f" ] && { EMPTY=0; break; }
done
[ "$EMPTY" -eq 0 ] || { echo "ERROR: no files to publish in $SUITE" >&2; exit 1; }
WORK=$(mktemp -d) WORK=$(mktemp -d)
TAR=$(mktemp) TAR=$(mktemp)
trap 'rm -rf "$WORK" "$TAR"' EXIT trap 'rm -rf "$WORK" "$TAR"' EXIT
+9 -1
View File
@@ -15,7 +15,7 @@ setup() {
teardown() { teardown() {
mock_stop mock_stop
rm -rf "unit-tests" "sub" rm -rf "unit-tests" "sub" "empty-suite"
} }
@test "missing suite_path argument → exit 1" { @test "missing suite_path argument → exit 1" {
@@ -58,6 +58,14 @@ teardown() {
[[ "$output" == *"not a directory"* ]] [[ "$output" == *"not a directory"* ]]
} }
@test "empty directory → exit 1" {
mkdir -p "empty-suite"
run bash scripts/publish-git-pages.sh "empty-suite"
[ "$status" -eq 1 ]
[[ "$output" == *"no files to publish"* ]]
rm -rf "empty-suite"
}
@test "valid publish returns report base URL" { @test "valid publish returns report base URL" {
mock_set_sequence '[ mock_set_sequence '[
{"code":200,"body":"published"} {"code":200,"body":"published"}