Install dependencies and build the package with poetry.
_Github actions run on a remote server that may not have poetry installed, nor the appropriate version of Python. You will need to learn how to specify this information appropriately.
Convert your (successful) test notebook to a python file using the jupyter nbconvert command.
The converted test notebook should not be checked into the repository; this is a command you should execute remotely that is for the purposes of testing only.
Run the converted test file to ensure that it executes without error. This should generate a new image.
Compare the output of the test file with the image you uploaded to Resources. The images should be equal.
There are several ways you can compare two images. One way is to use the common Linux utility diff and bash, where you'd execute a command like
if [[ -z "`diff graph.png Resources/graph.png`" ]]; then
exit 0
else
exit 132
fi
A challenge with this exact approach is that there might be metadata embedded in the image unrelated to what you see, making a command-line version of this a bit challenging. You can also write a short python script that loads these images into member and performs a diff using Python packages, using assert to raise errors. Whatever you choose to do, make sure you test that the diff code works locally first, successfully detecting actually equivalent images without error and raising a detectable error on non-equivalent images.
Note: The 132 above has no meaning; I just chose it because it is one more than the max of the standard Linux error codes.
I noticed that you are missing graphviz as a dependency in your pyproject.toml file. To catch potential build errors like that in the future, you should set up continuous integration testing for this repository: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
Before you begin, upload the image your successful dot file produces to the Resources folder.
You should use Github Actions to do the following:
poetry
. _Github actions run on a remote server that may not have poetry installed, nor the appropriate version of Python. You will need to learn how to specify this information appropriately.jupyter nbconvert
command. The converted test notebook should not be checked into the repository; this is a command you should execute remotely that is for the purposes of testing only.There are several ways you can compare two images. One way is to use the common Linux utility
diff
and bash, where you'd execute a command likeA challenge with this exact approach is that there might be metadata embedded in the image unrelated to what you see, making a command-line version of this a bit challenging. You can also write a short python script that loads these images into member and performs a diff using Python packages, using
assert
to raise errors. Whatever you choose to do, make sure you test that the diff code works locally first, successfully detecting actually equivalent images without error and raising a detectable error on non-equivalent images.Note: The 132 above has no meaning; I just chose it because it is one more than the max of the standard Linux error codes.