ci: embed Mantis desktop previews

This commit is contained in:
Peter Steinberger
2026-05-05 07:23:08 +01:00
parent 24bd0b212f
commit 7f27c42ebd
2 changed files with 51 additions and 4 deletions

View File

@@ -407,6 +407,29 @@ jobs:
capture_desktop_lane baseline
capture_desktop_lane candidate
make_desktop_preview() {
local lane="$1"
local input="$root/$lane/discord-status-reactions-tool-only-desktop.mp4"
local output="$root/$lane/discord-status-reactions-tool-only-desktop-preview.gif"
local palette="$root/$lane/discord-status-reactions-tool-only-desktop-preview-palette.png"
ffmpeg -y -i "$input" -vf "fps=4,scale=640:-1:flags=lanczos,palettegen=stats_mode=diff" -frames:v 1 -update 1 "$palette"
ffmpeg -y -i "$input" -i "$palette" -lavfi "fps=4,scale=640:-1:flags=lanczos[x];[x][1:v]paletteuse=dither=bayer:bayer_scale=3:diff_mode=rectangle" -loop 0 "$output"
rm -f "$palette"
}
if ! command -v ffmpeg >/dev/null 2>&1; then
sudo apt-get update && sudo apt-get install -y ffmpeg || true
fi
if command -v ffmpeg >/dev/null 2>&1; then
if ! make_desktop_preview baseline || ! make_desktop_preview candidate; then
rm -f "$root/baseline/discord-status-reactions-tool-only-desktop-preview.gif"
rm -f "$root/candidate/discord-status-reactions-tool-only-desktop-preview.gif"
echo "::warning::Could not generate animated desktop previews; continuing with screenshots and MP4 links."
fi
else
echo "::warning::ffmpeg is unavailable; skipping animated desktop previews."
fi
baseline_status="$(jq -r '.scenarios[0].status' "$root/baseline/discord-qa-summary.json")"
candidate_status="$(jq -r '.scenarios[0].status' "$root/candidate/discord-qa-summary.json")"
@@ -432,6 +455,12 @@ jobs:
echo "- Candidate screenshot: \`candidate/discord-status-reactions-tool-only-timeline.png\`"
echo "- Baseline desktop screenshot: \`baseline/discord-status-reactions-tool-only-desktop.png\`"
echo "- Candidate desktop screenshot: \`candidate/discord-status-reactions-tool-only-desktop.png\`"
if [[ -f "$root/baseline/discord-status-reactions-tool-only-desktop-preview.gif" ]]; then
echo "- Baseline desktop preview: \`baseline/discord-status-reactions-tool-only-desktop-preview.gif\`"
fi
if [[ -f "$root/candidate/discord-status-reactions-tool-only-desktop-preview.gif" ]]; then
echo "- Candidate desktop preview: \`candidate/discord-status-reactions-tool-only-desktop-preview.gif\`"
fi
echo "- Baseline desktop video: \`baseline/discord-status-reactions-tool-only-desktop.mp4\`"
echo "- Candidate desktop video: \`candidate/discord-status-reactions-tool-only-desktop.mp4\`"
} > "$root/mantis-report.md"
@@ -524,6 +553,12 @@ jobs:
cp "$root/candidate/discord-status-reactions-tool-only-timeline.png" "$artifacts_worktree/$artifact_root/candidate.png"
cp "$root/baseline/discord-status-reactions-tool-only-desktop.png" "$artifacts_worktree/$artifact_root/baseline-desktop.png"
cp "$root/candidate/discord-status-reactions-tool-only-desktop.png" "$artifacts_worktree/$artifact_root/candidate-desktop.png"
has_desktop_previews="false"
if [[ -f "$root/baseline/discord-status-reactions-tool-only-desktop-preview.gif" && -f "$root/candidate/discord-status-reactions-tool-only-desktop-preview.gif" ]]; then
cp "$root/baseline/discord-status-reactions-tool-only-desktop-preview.gif" "$artifacts_worktree/$artifact_root/baseline-desktop-preview.gif"
cp "$root/candidate/discord-status-reactions-tool-only-desktop-preview.gif" "$artifacts_worktree/$artifact_root/candidate-desktop-preview.gif"
has_desktop_previews="true"
fi
cp "$root/baseline/discord-status-reactions-tool-only-desktop.mp4" "$artifacts_worktree/$artifact_root/baseline-desktop.mp4"
cp "$root/candidate/discord-status-reactions-tool-only-desktop.mp4" "$artifacts_worktree/$artifact_root/candidate-desktop.mp4"
cp "$root/comparison.json" "$artifacts_worktree/$artifact_root/comparison.json"
@@ -542,6 +577,16 @@ jobs:
baseline_status="$(jq -r '.baseline.status' "$root/comparison.json")"
candidate_status="$(jq -r '.candidate.status' "$root/comparison.json")"
pass="$(jq -r '.pass' "$root/comparison.json")"
preview_section=""
if [[ "$has_desktop_previews" == "true" ]]; then
preview_section="$(cat <<EOF
| Baseline animated preview | Candidate animated preview |
| --- | --- |
| <img src="${raw_base}/baseline-desktop-preview.gif" width="420" alt="Animated baseline desktop preview"> | <img src="${raw_base}/candidate-desktop-preview.gif" width="420" alt="Animated candidate desktop preview"> |
EOF
)"
fi
comment_file="$(mktemp)"
cat > "$comment_file" <<EOF
<!-- mantis-discord-status-reactions -->
@@ -564,8 +609,9 @@ jobs:
| Baseline desktop/VNC browser | Candidate desktop/VNC browser |
| --- | --- |
| <img src="${raw_base}/baseline-desktop.png" width="420" alt="Baseline Mantis desktop browser screenshot"> | <img src="${raw_base}/candidate-desktop.png" width="420" alt="Candidate Mantis desktop browser screenshot"> |
${preview_section}
Videos:
Full videos:
- [Baseline desktop MP4](${raw_base}/baseline-desktop.mp4)
- [Candidate desktop MP4](${raw_base}/candidate-desktop.mp4)