Skip to content

Commit cbcca6e

Browse files
committed
ci: use Crabbox media previews for Mantis
1 parent 0e7073a commit cbcca6e

2 files changed

Lines changed: 51 additions & 25 deletions

File tree

.github/workflows/mantis-discord-status-reactions.yml

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -411,23 +411,23 @@ jobs:
411411
local lane="$1"
412412
local input="$root/$lane/discord-status-reactions-tool-only-desktop.mp4"
413413
local output="$root/$lane/discord-status-reactions-tool-only-desktop-preview.gif"
414-
local palette="$root/$lane/discord-status-reactions-tool-only-desktop-preview-palette.png"
415-
ffmpeg -y -i "$input" -vf "fps=4,scale=640:-1:flags=lanczos,palettegen=stats_mode=diff" -frames:v 1 -update 1 "$palette"
416-
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"
417-
rm -f "$palette"
414+
local clip="$root/$lane/discord-status-reactions-tool-only-desktop-change.mp4"
415+
local metadata="$root/$lane/discord-status-reactions-tool-only-desktop-preview.json"
416+
crabbox media preview \
417+
--input "$input" \
418+
--output "$output" \
419+
--trimmed-video-output "$clip" \
420+
--json > "$metadata"
418421
}
419422
420-
if ! command -v ffmpeg >/dev/null 2>&1; then
421-
sudo apt-get update && sudo apt-get install -y ffmpeg || true
422-
fi
423-
if command -v ffmpeg >/dev/null 2>&1; then
424-
if ! make_desktop_preview baseline || ! make_desktop_preview candidate; then
425-
rm -f "$root/baseline/discord-status-reactions-tool-only-desktop-preview.gif"
426-
rm -f "$root/candidate/discord-status-reactions-tool-only-desktop-preview.gif"
427-
echo "::warning::Could not generate animated desktop previews; continuing with screenshots and MP4 links."
428-
fi
429-
else
430-
echo "::warning::ffmpeg is unavailable; skipping animated desktop previews."
423+
if ! make_desktop_preview baseline || ! make_desktop_preview candidate; then
424+
rm -f "$root/baseline/discord-status-reactions-tool-only-desktop-preview.gif"
425+
rm -f "$root/candidate/discord-status-reactions-tool-only-desktop-preview.gif"
426+
rm -f "$root/baseline/discord-status-reactions-tool-only-desktop-change.mp4"
427+
rm -f "$root/candidate/discord-status-reactions-tool-only-desktop-change.mp4"
428+
rm -f "$root/baseline/discord-status-reactions-tool-only-desktop-preview.json"
429+
rm -f "$root/candidate/discord-status-reactions-tool-only-desktop-preview.json"
430+
echo "::warning::Could not generate motion-trimmed desktop previews; continuing with screenshots and full MP4 links."
431431
fi
432432
433433
baseline_status="$(jq -r '.scenarios[0].status' "$root/baseline/discord-qa-summary.json")"
@@ -461,6 +461,12 @@ jobs:
461461
if [[ -f "$root/candidate/discord-status-reactions-tool-only-desktop-preview.gif" ]]; then
462462
echo "- Candidate desktop preview: \`candidate/discord-status-reactions-tool-only-desktop-preview.gif\`"
463463
fi
464+
if [[ -f "$root/baseline/discord-status-reactions-tool-only-desktop-change.mp4" ]]; then
465+
echo "- Baseline desktop change clip: \`baseline/discord-status-reactions-tool-only-desktop-change.mp4\`"
466+
fi
467+
if [[ -f "$root/candidate/discord-status-reactions-tool-only-desktop-change.mp4" ]]; then
468+
echo "- Candidate desktop change clip: \`candidate/discord-status-reactions-tool-only-desktop-change.mp4\`"
469+
fi
464470
echo "- Baseline desktop video: \`baseline/discord-status-reactions-tool-only-desktop.mp4\`"
465471
echo "- Candidate desktop video: \`candidate/discord-status-reactions-tool-only-desktop.mp4\`"
466472
} > "$root/mantis-report.md"
@@ -499,7 +505,7 @@ jobs:
499505
permission-issues: write
500506
permission-pull-requests: write
501507

502-
- name: Comment PR with inline QA screenshots
508+
- name: Comment PR with inline QA evidence
503509
if: ${{ always() && needs.resolve_request.outputs.pr_number != '' && steps.run_mantis.outputs.output_dir != '' }}
504510
env:
505511
GH_TOKEN: ${{ steps.mantis_app_token.outputs.token }}
@@ -557,8 +563,16 @@ jobs:
557563
if [[ -f "$root/baseline/discord-status-reactions-tool-only-desktop-preview.gif" && -f "$root/candidate/discord-status-reactions-tool-only-desktop-preview.gif" ]]; then
558564
cp "$root/baseline/discord-status-reactions-tool-only-desktop-preview.gif" "$artifacts_worktree/$artifact_root/baseline-desktop-preview.gif"
559565
cp "$root/candidate/discord-status-reactions-tool-only-desktop-preview.gif" "$artifacts_worktree/$artifact_root/candidate-desktop-preview.gif"
566+
cp "$root/baseline/discord-status-reactions-tool-only-desktop-preview.json" "$artifacts_worktree/$artifact_root/baseline-desktop-preview.json"
567+
cp "$root/candidate/discord-status-reactions-tool-only-desktop-preview.json" "$artifacts_worktree/$artifact_root/candidate-desktop-preview.json"
560568
has_desktop_previews="true"
561569
fi
570+
has_change_clips="false"
571+
if [[ -f "$root/baseline/discord-status-reactions-tool-only-desktop-change.mp4" && -f "$root/candidate/discord-status-reactions-tool-only-desktop-change.mp4" ]]; then
572+
cp "$root/baseline/discord-status-reactions-tool-only-desktop-change.mp4" "$artifacts_worktree/$artifact_root/baseline-desktop-change.mp4"
573+
cp "$root/candidate/discord-status-reactions-tool-only-desktop-change.mp4" "$artifacts_worktree/$artifact_root/candidate-desktop-change.mp4"
574+
has_change_clips="true"
575+
fi
562576
cp "$root/baseline/discord-status-reactions-tool-only-desktop.mp4" "$artifacts_worktree/$artifact_root/baseline-desktop.mp4"
563577
cp "$root/candidate/discord-status-reactions-tool-only-desktop.mp4" "$artifacts_worktree/$artifact_root/candidate-desktop.mp4"
564578
cp "$root/comparison.json" "$artifacts_worktree/$artifact_root/comparison.json"
@@ -581,12 +595,22 @@ jobs:
581595
if [[ "$has_desktop_previews" == "true" ]]; then
582596
preview_section="$(cat <<EOF
583597
584-
| Baseline animated preview | Candidate animated preview |
598+
| Baseline motion preview | Candidate motion preview |
585599
| --- | --- |
586600
| <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"> |
587601
EOF
588602
)"
589603
fi
604+
change_clip_section=""
605+
if [[ "$has_change_clips" == "true" ]]; then
606+
change_clip_section="$(cat <<EOF
607+
608+
Motion-trimmed clips:
609+
- [Baseline change MP4](${raw_base}/baseline-desktop-change.mp4)
610+
- [Candidate change MP4](${raw_base}/candidate-desktop-change.mp4)
611+
EOF
612+
)"
613+
fi
590614
comment_file="$(mktemp)"
591615
cat > "$comment_file" <<EOF
592616
<!-- mantis-discord-status-reactions -->
@@ -610,6 +634,7 @@ jobs:
610634
| --- | --- |
611635
| <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"> |
612636
${preview_section}
637+
${change_clip_section}
613638
614639
Full videos:
615640
- [Baseline desktop MP4](${raw_base}/baseline-desktop.mp4)
@@ -628,13 +653,13 @@ jobs:
628653
comment_payload="$(mktemp)"
629654
jq -n --rawfile body "$comment_file" '{ body: $body }' > "$comment_payload"
630655
if gh api --method PATCH "repos/${GITHUB_REPOSITORY}/issues/comments/${comment_id}" --input "$comment_payload" >/dev/null; then
631-
echo "Updated Mantis QA screenshot comment on PR #${TARGET_PR}."
656+
echo "Updated Mantis QA evidence comment on PR #${TARGET_PR}."
632657
else
633-
echo "::warning::Could not update existing Mantis QA screenshot comment ${comment_id}; creating a new one."
658+
echo "::warning::Could not update existing Mantis QA evidence comment ${comment_id}; creating a new one."
634659
gh pr comment "$TARGET_PR" --body-file "$comment_file"
635-
echo "Created Mantis QA screenshot comment on PR #${TARGET_PR}."
660+
echo "Created Mantis QA evidence comment on PR #${TARGET_PR}."
636661
fi
637662
else
638663
gh pr comment "$TARGET_PR" --body-file "$comment_file"
639-
echo "Created Mantis QA screenshot comment on PR #${TARGET_PR}."
664+
echo "Created Mantis QA evidence comment on PR #${TARGET_PR}."
640665
fi

docs/concepts/mantis.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,11 @@ worktrees, runs `discord-status-reactions-tool-only` against each worktree, and
168168
uploads `baseline/`, `candidate/`, `comparison.json`, and `mantis-report.md` as
169169
Actions artifacts. It also renders each lane's timeline HTML in a Crabbox
170170
desktop browser and publishes those VNC screenshots beside the deterministic
171-
timeline PNGs in the PR comment. The same PR comment embeds lightweight animated
172-
GIF previews generated from the VNC desktop recordings and links to the full
173-
desktop MP4 files, while the screenshots stay inline for quick review. The
174-
workflow builds the Crabbox CLI from
171+
timeline PNGs in the PR comment. The same PR comment embeds lightweight
172+
motion-trimmed GIF previews generated by `crabbox media preview`, links to the
173+
matching motion-trimmed MP4 clips, and keeps the full desktop MP4 files for deep
174+
inspection. Screenshots stay inline for quick review. The workflow builds the
175+
Crabbox CLI from
175176
`openclaw/crabbox` main so it can use the current desktop/browser lease flags
176177
before the next Crabbox binary release is cut.
177178

0 commit comments

Comments
 (0)