Fix/ci kontin no internet vaatimus (#34)
CI Main / Load example-gitea-env.conf to pipeline env (push) Successful in 22s
CI Main / Check existing artifact (push) Successful in 18s
acc-tests Cucumber test report
unit-tests Bats test report
CI Main / Cucumber tests (push) Successful in 1m25s
CI Main / Bats tests (push) Successful in 1m26s
ci-docker-build-push Docker build & push 0.2.19 OK
CI Main / Build & Push Docker (push) Successful in 47s
CI Main / Report Summary (push) Successful in 6s
CI Main / Move provider version tag (push) Successful in 16s
CI Main / Load example-gitea-env.conf to pipeline env (push) Successful in 22s
CI Main / Check existing artifact (push) Successful in 18s
acc-tests Cucumber test report
unit-tests Bats test report
CI Main / Cucumber tests (push) Successful in 1m25s
CI Main / Bats tests (push) Successful in 1m26s
ci-docker-build-push Docker build & push 0.2.19 OK
CI Main / Build & Push Docker (push) Successful in 47s
CI Main / Report Summary (push) Successful in 6s
CI Main / Move provider version tag (push) Successful in 16s
Co-authored-by: moilanik <niko.moilanen@tietoevry.com> Reviewed-on: #34
This commit was merged in pull request #34.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
SUITE_PATH="${1:-}"
|
||||
|
||||
@@ -12,7 +12,7 @@ SUITE_PATH="${1:-}"
|
||||
|
||||
OWNER="${GITHUB_REPOSITORY%%/*}"
|
||||
REPO="${GITHUB_REPOSITORY##*/}"
|
||||
SHA8="${GITHUB_SHA:0:8}"
|
||||
SHA8=$(echo "$GITHUB_SHA" | cut -c1-8)
|
||||
PAGES_USER="${GIT_PAGES_PUBLISH_USER:-publish}"
|
||||
REPORT_DIR="reports/${SHA8}/${SUITE_PATH%/}"
|
||||
REPORT_BASE="${GIT_PAGES_URL}/${OWNER}/${REPO}/reports/${SHA8}"
|
||||
@@ -33,17 +33,30 @@ else
|
||||
fi
|
||||
mkdir -p "$TARGET"
|
||||
cp -a "$REPORT_DIR/." "$TARGET/"
|
||||
if [ ! -f "$TARGET/index.html" ]; then
|
||||
items=()
|
||||
while IFS= read -r -d '' f; do
|
||||
items+=("$(basename "$f")")
|
||||
done < <(find "$TARGET" -maxdepth 1 -type f ! -name index.html -print0 2>/dev/null || true)
|
||||
while IFS= read -r -d '' d; do
|
||||
name=$(basename "$d")
|
||||
[ -f "$d/index.html" ] && items+=("$name")
|
||||
done < <(find "$TARGET" -maxdepth 1 -type d ! -name . -print0 2>/dev/null || true)
|
||||
|
||||
if [ ${#items[@]} -gt 1 ]; then
|
||||
if [ ! -f "$TARGET/index.html" ]; then
|
||||
ITEM_LIST=""
|
||||
ITEM_COUNT=0
|
||||
|
||||
for f in "$TARGET"/*; do
|
||||
[ -f "$f" ] || continue
|
||||
base=$(basename "$f")
|
||||
[ "$base" = "index.html" ] && continue
|
||||
ITEM_LIST="${ITEM_LIST}file:${base}
|
||||
"
|
||||
ITEM_COUNT=$((ITEM_COUNT + 1))
|
||||
done
|
||||
|
||||
for d in "$TARGET"/*/; do
|
||||
[ -d "$d" ] || continue
|
||||
base=$(basename "$d")
|
||||
[ -f "$d/index.html" ] || continue
|
||||
ITEM_LIST="${ITEM_LIST}dir:${base}
|
||||
"
|
||||
ITEM_COUNT=$((ITEM_COUNT + 1))
|
||||
done
|
||||
|
||||
if [ "$ITEM_COUNT" -gt 1 ]; then
|
||||
{
|
||||
echo '<!DOCTYPE html><html lang="en"><head><meta charset="utf-8">'
|
||||
echo "<title>Test report ${SHA8}</title>"
|
||||
@@ -53,16 +66,21 @@ if [ ! -f "$TARGET/index.html" ]; then
|
||||
echo 'a{color:#2563eb;text-decoration:none}a:hover{text-decoration:underline}'
|
||||
echo '</style></head><body>'
|
||||
echo "<h1>Test report <code>${SHA8}</code></h1><ul>"
|
||||
for item in "${items[@]}"; do
|
||||
label="${item%.*}"
|
||||
label="${label//-/ }"
|
||||
label="${label//_/ }"
|
||||
if [ -f "$TARGET/$item" ]; then
|
||||
echo "<li><a href=\"$item\">${label^}</a></li>"
|
||||
|
||||
echo "$ITEM_LIST" | while IFS= read -r item; do
|
||||
[ -z "$item" ] && continue
|
||||
item_type=$(echo "$item" | cut -d: -f1)
|
||||
item_name=$(echo "$item" | cut -d: -f2-)
|
||||
label=$(echo "$item_name" | sed -e 's/\.[^.]*$//' -e 's/[-_]/ /g')
|
||||
first=$(echo "$label" | cut -c1 | tr '[:lower:]' '[:upper:]')
|
||||
rest=$(echo "$label" | cut -c2-)
|
||||
if [ "$item_type" = "file" ]; then
|
||||
echo "<li><a href=\"$item_name\">${first}${rest}</a></li>"
|
||||
else
|
||||
echo "<li><a href=\"$item/index.html\">${label^}</a></li>"
|
||||
echo "<li><a href=\"$item_name/index.html\">${first}${rest}</a></li>"
|
||||
fi
|
||||
done
|
||||
|
||||
echo '</ul></body></html>'
|
||||
} > "$TARGET/index.html"
|
||||
fi
|
||||
@@ -74,7 +92,7 @@ EOF
|
||||
find "$WORK/$OWNER" \( -type f -o -type l \) -print | sed "s|^${WORK}/||" | tar -cf "$TAR" -C "$WORK" -T -
|
||||
|
||||
publish() {
|
||||
local method="$1"
|
||||
method="$1"
|
||||
curl -sS -X "$method" "$PUBLISH_SITE_URL" \
|
||||
-u "${PAGES_USER}:${GIT_PAGES_PUBLISH_TOKEN}" \
|
||||
-H "Content-Type: application/x-tar" \
|
||||
|
||||
Reference in New Issue
Block a user