Fortran-FOSS-Programmers / ford

Automatically generates FORtran Documentation from comments within the code.
https://forddocs.readthedocs.io
GNU General Public License v3.0
402 stars 131 forks source link

actions: Build Docker container containing FORD #649

Open kc9jud opened 3 months ago

kc9jud commented 3 months ago

This constructs an Alpine-based Docker image with FORD installed. This can then be used for CI/CD builds of documentation for projects. For instance, one could then use this for GitLab pages:

.gitlab-ci:

# The Docker image that will be used to build your app
image: ghcr.io/Fortran-FOSS-Programmers/ford:latest
pages:
  script:
    - mkdir -p public
    - ford -o public README.md
  artifacts:
    paths:
      # The folder that contains the files to be exposed at the Page URL
      - public
  rules:
    # This ensures that only pushes to the default branch will trigger
    # a pages deploy
    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
ZedThree commented 3 months ago

Thanks @kc9jud! Is this just to get graphviz installed? It's not immediately obvious to me why this basically couldn't just be pip install ford, rather than building from source directly?

kc9jud commented 3 months ago

@ZedThree To get GraphViz to work I just had to switch back to python:3-slim rather than python:3-alpine...

No, you're right that it could just be pip install ford if it were part of the PyPI pipeline -- building from source was a way of solving the race condition of publishing to PyPI vs downloading/installing from PyPI. You don't want the image for v7.0.6 having v7.0.5 inside because it pulled from PyPI before the publish job finished.

It also means that, for example, ghcr.io/kc9jud/ford:master is an image which always has the latest commit to master, in addition to ghcr.io/kc9jud/ford:latest which has the most recent release.