1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 14:49:06 -04:00

Add workflow to accept snapshots via kitdiff (#7577)

This adds a new workflow `update_kittest_snapshots.yml` that can be
triggered through the [kitdiff](https://github.com/rerun-io/kitdiff) ui
when viewing a ci artefact.
Also adds a link to kitdiff to view the pr changes to each commit (via
the preview build comment)

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Lucas Meurer
2025-10-06 15:57:31 +02:00
committed by GitHub
parent f6fe3bff18
commit f0faacc7d1
5 changed files with 77 additions and 11 deletions

14
scripts/accept_snapshots.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/sh
# This script moves all {name}.new.png files to {name}.png.
# Its main use is in the update_kittest_snapshots CI job, but you can also use it locally.
set -eu
# rename the .new.png files to .png
find . -type d -path "*/tests/snapshots*" | while read dir; do
find "$dir" -type f -name "*.new.png" | while read file; do
mv -f "$file" "${file%.new.png}.png"
done
done
echo "Done!"

View File

@@ -8,9 +8,12 @@ set -eu
BRANCH=$(git rev-parse --abbrev-ref HEAD)
RUN_ID=$(gh run list --branch "$BRANCH" --workflow "Rust" --json databaseId -q '.[0].databaseId')
echo "Downloading test results from run $RUN_ID from branch $BRANCH"
if [ -z "${RUN_ID:-}" ]; then
RUN_ID=$(gh run list --branch "$BRANCH" --workflow "Rust" --json databaseId -q '.[0].databaseId')
echo "Downloading test results from run $RUN_ID from branch $BRANCH"
else
echo "Using provided RUN_ID: $RUN_ID"
fi
# remove any existing .new.png that might have been left behind
find . -type d -path "*/tests/snapshots*" | while read dir; do
@@ -27,11 +30,4 @@ rsync -a tmp_artefacts/ .
rm -r tmp_artefacts
# rename the .new.png files to .png
find . -type d -path "*/tests/snapshots*" | while read dir; do
find "$dir" -type f -name "*.new.png" | while read file; do
mv -f "$file" "${file%.new.png}.png"
done
done
echo "Done!"
./scripts/accept_snapshots.sh