ammaraskar / sphinx-action

Github action that builds docs using sphinx and places errors inline
Apache License 2.0
189 stars 114 forks source link

Switch to 'sphinxdoc/sphinx-latexpdf', or offer as an alternative? #40

Open ferdnyc opened 2 years ago

ferdnyc commented 2 years ago

While working on #39, I also noticed that the Sphinx team have a second container image, spinxdoc/sphinx-latexpdf which they maintain in parallel to sphinxdoc/sphinx. The image is, as they caution, huge (2GB!), but the tradeoff is that it contains nearly all of the packages that users who run apt install <incredible amounts of texlive stuff> will be downloading anyway, every time they use the action.

Presumably GitHub caches docker images, whereas the apt install into the container can't be cached, so using the image would seem like a more efficient way of using latexpdf for those who need it. It might be too heavy to use for every sphinx-action run, but perhaps it could be offered as an alternate image?

I was thinking about how that could be done, and I think this would work (in action.yml):

inputs:
  # ...
  latexpdf:
    description:
      Use a container with latexpdf and dependencies pre-installed
    required: false
    default: false
 runs:
  - using: 'docker'
    if: ${{ inputs.latexpdf == false }}
    image: 'Dockerfile'
  - using: 'docker'
    if: ${{ inputs.latexpdf == true }}
    using 'Dockerfile.latexpdf'

If that doesn't fly, or is just too messy, then maybe even publishing a second action based on sphinx_action, but using sphinxdoc/sphinx-latexpdf, would be worth it?