File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6565 name : Check if there are valid files
6666 shell : bash
6767 run : |
68- # Find roborazzi diff PNGs in the downloaded artifact.
69- mapfile -t files_to_add < <(find . -path '*/roborazzi /*' -name "*_compare.png" -type f)
68+ # Find roborazzi diff PNGs in the downloaded artifact (in <TestClass>/diffs/) .
69+ mapfile -t files_to_add < <(find . -path '*/diffs /*' -name "*_compare.png" -type f)
7070 if [ ${#files_to_add[@]} -gt 0 ]; then
7171 exist_valid_files="true"
7272 else
@@ -83,17 +83,17 @@ jobs:
8383 BASE_REF : ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.pull_requests[0].base.ref || github.event.repository.default_branch }}
8484 shell : bash
8585 run : |
86- # Find roborazzi diff PNGs to mention in the comment.
87- mapfile -t files < <(find . -path '*/roborazzi /*' -name "*_compare.png" -type f | sort)
86+ # Find roborazzi diff PNGs to mention in the comment (in <TestClass>/diffs/) .
87+ mapfile -t files < <(find . -path '*/diffs /*' -name "*_compare.png" -type f | sort)
8888 total=${#files[@]}
8989 # Cap the full list so we remain within GitHub's comment limit
9090 max_details=100
9191
92- # Group by test class — the directory immediately under roborazzi /.
92+ # Group by test class — the directory containing diffs /.
9393 declare -A class_counts class_files
9494 for file in "${files[@]}"; do
95- rest ="${file#*/roborazzi/ }"
96- class="${rest%%/* }"
95+ class_dir ="${file%/diffs/* }"
96+ class="${class_dir##*/ }"
9797 class_counts[$class]=$(( ${class_counts[$class]:-0} + 1 ))
9898 class_files[$class]+="$(basename "$file")"$'\n'
9999 done
Original file line number Diff line number Diff line change @@ -67,13 +67,24 @@ jobs:
6767 run : |
6868 ./gradlew compareRoborazziPlayDebug -Pscreenshot --stacktrace
6969
70+ - name : Stage screenshot diffs
71+ if : ${{ always() }}
72+ env :
73+ # Folder name inside the artifact (e.g. "screenshot-diff-pr-12345" on PRs, "screenshot-diff-main" on push)
74+ SUBDIR : ${{ github.event_name == 'pull_request' && format('screenshot-diff-pr-{0}', github.event.number) || format('screenshot-diff-{0}', github.ref_name) }}
75+ run : |
76+ # Trim 'AnkiDroid/build/outputs/roborazzi' from the artifact and namespace by PR/branch
77+ mkdir -p screenshot-diff
78+ if [ -d AnkiDroid/build/outputs/roborazzi ]; then
79+ mv AnkiDroid/build/outputs/roborazzi "screenshot-diff/$SUBDIR"
80+ fi
81+
7082 - name : Upload screenshot diffs
7183 uses : actions/upload-artifact@v4
7284 if : ${{ always() }}
7385 with :
7486 name : screenshot-diff # referenced by screenshot_comment.yml
75- path : |
76- **/build/outputs/roborazzi
87+ path : screenshot-diff
7788 retention-days : 30
7889
7990 - name : Upload screenshot diff reports
You can’t perform that action at this time.
0 commit comments