Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Actions to generate and deploy documentation from master branch #737

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,30 @@ jobs:
- name: apt-update
run: sudo apt-get update -qq
- name: apt-get doxygen
run: sudo apt-get install -y doxygen
- name: build doc
run: sudo apt-get install -y doxygen graphviz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is graphviz being used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

graphviz is the project that creates the DOT graphing engines which doxygen will call to produce code graphs. See here for an example. The use of DOT is default for doxygen, but can be disabled in the Doxyfile. I personally, always like to have the graphs.

- name: build docs
run: make docs
- name: deploy
uses: peaceiris/actions-gh-pages@v4
- name: Upload static files as artifact
id: deployment
uses: actions/upload-pages-artifact@v3 # or specific "vX.X.X" version tag for this action
Comment on lines +19 to +21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some of this was copied from the docs at https://github.com/actions/upload-pages-artifact

Any reason to move away from actions-gh-pages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gh-pages requires that a branch be created specifically to hold generated artifacts. That is, the HTML site that gets generated now needs to be committed to the repo; which (IMHO) defeats one of the major purposes of automated documentation generation.

This PR removes the dependency on a specific branch and generates the content straight from master as an artifact that github handles itself. Thus, no repo storage of an output artifact. Which can help to prevent issues where the output artifact gets out of sync with the source.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and yes. I used the https://github.com/actions/upload-pages-artifact as a reference for this update.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Globally I'm ok with the solution, which means no need for a specific gh-pages branch anymore.
But also no immediate way to see the public pages have been updated unless checking deployment jobs. Until now that commit to gh-pages was a clear indicator.
I'm ok with it, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the make file, we can set the standard build job to also make docs, then produce warnings or errors on documentation. That way the build or PR check fails

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I want PR to be blocked by documentation generation errors either. Just trying to find a way to get into automation (which is good) without loosing automated information :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honest question. Why not enforce documentation?

In the least, it's a single line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation building failures should not block someone from contributing to the project. But that's just like my opinion, man.

with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/html/
enable_jekyll: false
allow_empty_commit: false
force_orphan: true
path: docs/html/

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build-documentation
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4



8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
######################################################################################

## path stuff
DOCS_PATH:=./doc
DOCS_PATH:=./docs
DEMO_PATH=demo
SRC_PATH=src

Expand Down Expand Up @@ -64,14 +64,14 @@ nuke: $(addprefix $(SRC_PATH)/, $(SRC))

docs: $(DOCS_PATH)/html/index.html

$(DOCS_PATH)/html/index.html: $(DOCS_PATH)/doxygen-awesome-css/doxygen-awesome.css $(DOXYFILE)
$(DOCS_PATH)/html/index.html: $(DOCS_PATH)/html/doxygen-awesome-css/doxygen-awesome.css $(DOXYFILE)
doxygen $(DOXYFILE)

$(DOXYFILE):
doxygen -g $@

$(DOCS_PATH)/doxygen-awesome-css/doxygen-awesome.css:
git clone https://github.com/jothepro/doxygen-awesome-css.git $(DOCS_PATH)/doxygen-awesome-css --branch v2.3.4
$(DOCS_PATH)/html/doxygen-awesome-css/doxygen-awesome.css:
git clone https://github.com/jothepro/doxygen-awesome-css.git $(DOCS_PATH)/html/doxygen-awesome-css --branch v2.3.4



Expand Down
4 changes: 2 additions & 2 deletions doc/Doxyfile → docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ PROJECT_LOGO =
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.

OUTPUT_DIRECTORY = ./doc
OUTPUT_DIRECTORY = ./docs

# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096
# sub-directories (in 2 levels) under the output directory of each output format
Expand Down Expand Up @@ -1333,7 +1333,7 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_EXTRA_STYLESHEET = ./doc/doxygen-awesome-css/doxygen-awesome.css
HTML_EXTRA_STYLESHEET = ./docs/html/doxygen-awesome-css/doxygen-awesome.css

# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
Expand Down