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

Conversation

awschult002
Copy link
Contributor

@awschult002 awschult002 commented Nov 18, 2024

based on the great work of @riri in PR #734 . i have taken things 1 step further and updated the actions to allow generation of documentation directly from the master branch. Not only does it generate from the master branch; it also does so without the need to store any HTML in the repo. no separate branches or anything.

The way it works is by github actions allowing the upload of artifacts. So, on push, the action builds the code, then builds the documentation, then uploads the html directory as an artifact.

Then the deployment action grabs the artifact and deploys that as a webpage. You can view the web page example on my repo linked here

CRITICAL: the build and deployment settings for the repo will need to be updated from source = branch to source = github action

Note: i also took a moment to fix the errors around building DOT diagrams.

@@ -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.

Comment on lines +19 to +21
- name: Upload static files as artifact
id: deployment
uses: actions/upload-pages-artifact@v3 # or specific "vX.X.X" version tag for this action
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants