Github 操作引发 "convert-im6.q16: unable to read font `FreeMono'" 错误和类似

Github action raises "convert-im6.q16: unable to read font `FreeMono'" error and similar

我正在尝试执行一些 Github 动作测试作为 CI 工作流程的一部分。这些测试应该执行相当多的 pdf / png 操作,但我遇到了 convert-im6.q16: unable to read font `FreeMono' 的问题。我试图通过在测试之前按照一些在线建议安装/重新安装 ghostscript 来修复这些问题,但没有成功。基本上 Github 动作看起来像:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      
      - name: quick tests
        run: |
          cd src
          bash install.sh
          cd ../tests/
          bash run_all_tests.sh

测试失败并输出以下内容:

convert-im6.q16: unable to read font `FreeMono' @ warning/annotate.c/RenderType/915.
convert-im6.q16: unable to read font `FreeMono' @ error/annotate.c/RenderFreetype/1338.
convert-im6.q16: non-conforming drawing primitive definition `text' @ error/draw.c/RenderMVGContent/4300.
convert-im6.q16: unable to read font `FreeMono' @ warning/annotate.c/RenderType/915.
convert-im6.q16: unable to read font `FreeMono' @ error/annotate.c/RenderFreetype/1338.
convert-im6.q16: non-conforming drawing primitive definition `text' @ error/draw.c/RenderMVGContent/4300.

这适用于我个人的 Ubuntu 20.04 机器,我认为我从来不需要调整 ghostscript 或 convert-im6(至少我不记得了)。

知道如何解决这些问题,使其在最新的 Github 操作 ubuntu 上以与在我的机器上相同的方式工作吗?

刚刚找到答案...我发现的 SO 问题(例如 ImageMagick: Error while running convert: convert: unable to read font , ImageMagickError unable to read font `(null)': `(null)' 等)只提到我需要安装 ghostscriptgs 或相关,但就我而言,我既需要 ghostscript 又需要单独安装字体。所以添加一个单独的步骤:

     - name: install ghostscript and its fonts
        run: |
          sudo apt-get install ghostscript
          sudo apt-get install fonts-freefont-otf

解决了我的问题。不确定为什么我的 Ubuntu 笔记本电脑上从来没有出现过此类问题,猜测与 github 操作提供的 ubuntu-latest 的一些配置差异 (?)。