8000 Deleting all images that have passed tests before upload · matplotlib/matplotlib@4c31f35 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4c31f35

Browse files
committed
Deleting all images that have passed tests before upload
Modified code to delete all types of files which have not failed Minor extension handling Checking if file exists before deleting Did not delete directories
1 parent 31655dc commit 4c31f35

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/tests.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff lin 103CD e numberDiff line change
@@ -318,6 +318,35 @@ jobs:
318318
--maxfail=50 --timeout=300 --durations=25 \
319319
--cov-report=xml --cov=lib --log-level=DEBUG --color=yes
320320
321+
- name: Cleanup non-failed image files
322+
run: |
323+
function remove_files() {
324+
local extension=$1
325+
find ./result_images -type f -name "*-expected*.$extension" | while read file; do
326+
if [[ $file == *"-expected_pdf"* ]]; then
327+
base=${file%-expected_pdf.$extension}_pdf
328+
elif [[ $file == *"-expected_eps"* ]]; then
329+
base=${file%-expected_eps.$extension}_eps
330+
elif [[ $file == *"-expected_svg"* ]]; then
331+
base=${file%-expected_svg.$extension}_svg
332+
else
333+
base=${file%-expected.$extension}
334+
fi
335+
if [[ ! -e "${base}-failed-diff.$extension" ]]; then
336+
if [[ -e "$file" ]]; then
337+
rm "$file"
338+
echo "Removed $file"
339+
fi
340+
if [[ -e "${base}.$extension" ]]; then
341+
rm "${base}.$extension"
342+
fi
343+
echo "Removed $file"
344+
fi
345+
done
346+
}
347+
348+
remove_files "png"; remove_files "svg"; remove_files "pdf"; remove_files "eps";
349+
321350
- name: Filter C coverage
322351
run: |
323352
if [[ "${{ runner.os }}" != 'macOS' ]]; then

0 commit comments

Comments
 (0)
0