boilerplate for standardize freetype in github actions?
I'm getting CI/CD fails on windows vs linux, and I suspect it's related to the text renderer, as described here: https://github.com/matplotlib/pytest-mpl#removing-text . When I added this option, they still seem to fail.
I'm using the standard "ubuntu-20.04" and "windows-2019" github action runners. Are there instructions anywhere or existing repos that can use this library in different environments using the standard runners?
I'd be happy to contribute a PR to update the docs for this repo, if someone can steer me in the correct direction. Thanks!
Hi @shapiromatron, it is difficult to test across multiple versions and platforms due to the text differences (because of different FreeType versions). Typically, the recommended solution is to run image comparison tests within a dedicated testing environment, which is configured to always uses the same GitHub Actions runner, Python version, and Matplotlib version. This is the standard recommendation from: https://github.com/matplotlib/pytest-mpl#package-version-dependencies
If figures also need to be tested on a different OS or a different dependency version, it is recommended to maintain a separate set of baseline hashes or images.
The remove text option doesn't remove all the text (as documented here), which may be why it doesn't work across different OSs.
Some more relevant issues here: https://github.com/matplotlib/pytest-mpl/issues?q=is%3Aissue+freetype
And when https://github.com/matplotlib/pytest-mpl/pull/150 is released, it should make cross platform testing work more reliably.
My way of dealing with this has been:
- For PyPI-based installs, make sure you allow matplotlib to download and install its default, internal copy of freetype (this is the default behavior)
- For conda-based installs, I have been maintaining packages on conda-forge under the "testing" label that are built with matplotlib's internal (consistent) freetype copy. These can be installed with
conda install -c conda-forge/label/testing matplotlib-base.