Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github action to compare compiled examples with known good versions #30

Closed
Tracked by #19
matsavage opened this issue Aug 20, 2023 · 1 comment
Closed
Tracked by #19

Comments

@matsavage
Copy link
Owner

matsavage commented Aug 20, 2023

There should be a way to automatically check that there has been no visual change in the PDFs produced by the actions pipeline

@matsavage matsavage linked a pull request Jan 15, 2024 that will close this issue
Closed
@matsavage
Copy link
Owner Author

matsavage commented Jan 15, 2024

Example script using imagemagick

#!/bin/bash

reference_files=`find /home/mathew-savage/Downloads/example_2_*`

# run imagemagick compare for all files
results=()
for file in $reference_files
do
  filename=`basename $file`
  result=`compare -metric mae /home/mathew-savage/Downloads/${filename} /home/mathew-savage/Downloads/result/${filename} difference_${filename}.png 2>&1`

  similarity=`echo $result | grep -oP '(?<=\().+?(?=\))'`
  similarity_percent="$(echo "$similarity * 100" | bc)"
  results+=($similarity_percent)

  printf "%s: difference from reference: %0.4f%% \n" $file $similarity_percent
done

# return 1 if any file is over threshold
for result in ${results[@]}
do
  if (( $(echo "$result > 0.01" | bc -l) )); then
    exit 1
  fi
done

exit 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant