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

Generate apidoc on build #336

Merged
merged 11 commits into from Dec 21, 2020
Merged

Conversation

vsaw
Copy link
Collaborator

@vsaw vsaw commented Dec 19, 2020

Closes #334

@tdurand
Copy link
Member

tdurand commented Dec 21, 2020

nice, but can we leave the apidoc in the /apidoc directory, otherwise we can't use the static pages of github to serve it: https://opendatacam.github.io/opendatacam/apidoc/ ?

@vsaw
Copy link
Collaborator Author

vsaw commented Dec 21, 2020

Ah I have not thought about this. I believe with github actions there should be a way to render a static page on every commit and serve it without having to have the build artifacts in git :-)

Will need to look into it first though.

Update

Quick googling found me https://github.com/marketplace/actions/github-pages-action for example. So it should be possible. Will update the PR when I get around :-)

But you might need to look and check if the github pages settings are done correctly as I can not see or change any settings for the repository.

@tdurand
Copy link
Member

tdurand commented Dec 21, 2020

okay ! just let me know what I need to do on the github page config and I'll do it 😎

@vsaw vsaw force-pushed the 334-apidoc-on-build branch 2 times, most recently from d45856f to c1a83cd Compare December 21, 2020 17:16
@vsaw
Copy link
Collaborator Author

vsaw commented Dec 21, 2020

@tdurand I've updated the pull request to do the following:

At any push in the master branch the apidoc.yml action will be triggered. The action will build the apidoc from source and then push the build artifacts to the gh-pages branch. GitHub can then serve the API documentation from the gh-pages branch, leaving the master branch (and any other branch) free of any build artifacts.

For this action to work you will need to make the following changes to the repository

  1. Set GitHub to serve the documentation from the gh-pages branch. See https://github.com/marketplace/actions/github-pages-action#%EF%B8%8F-first-deployment-with-github_token
  2. As this action performs writes on the gh-pages branch, make sure that you only share read tokens with your forks. Check https://github.com/opendatacam/opendatacam/settings/actions

If you want to see this action run successfully visit https://github.com/vsaw/opendatacam/actions/runs/436279892. This run created the API documentation that you can see at https://vsaw.github.io/opendatacam/ (the HTML generated by apidoc can be found at the gh-pages branch)

@tdurand
Copy link
Member

tdurand commented Dec 21, 2020

great ! only downside I see now (sorry) is that we will not have the nice Markdown as HTML like we had: https://opendatacam.github.io/opendatacam/ for the rest of the documentation.. but I think no one was reading the documentation there anyways.. And I think if we ever want to have a website for documentation it should be something a bit more usable than just the raw Markdown file as HTML.. something with a nice navigation menu 😁

So let's go , will try to merge this and setup correctly the github page !

@vsaw
Copy link
Collaborator Author

vsaw commented Dec 21, 2020

great ! only downside I see now (sorry) is that we will not have the nice Markdown as HTML like we had: https://opendatacam.github.io/opendatacam/ for the rest of the documentation..

With a bit more effort this can be implemented. We just need to call Jekyll or any static page generator and include the apidoc as a sub-page. Do you want me to fix this?

@tdurand
Copy link
Member

tdurand commented Dec 21, 2020

If you don't mind would be nice to have to be able to link to the documentation outside github markdown.

@tdurand
Copy link
Member

tdurand commented Dec 21, 2020

but let me know if it is not a quick fix and I'll go with this for now

@vsaw vsaw force-pushed the 334-apidoc-on-build branch 8 times, most recently from e90dda5 to 093ce0c Compare December 21, 2020 19:06
@vsaw
Copy link
Collaborator Author

vsaw commented Dec 21, 2020

but let me know if it is not a quick fix and I'll go with this for now

I've run into some undocumented behavior of GitHub. It seems that it does not automatically convert Markdown pages to HTML. So far I've only been able to do this on master and development. But I believe I can get it to do a Markdown to HTML conversion by moving the page to a subfolder. Will try this quickly.

@vsaw vsaw force-pushed the 334-apidoc-on-build branch 3 times, most recently from ee3f96c to fd1986f Compare December 21, 2020 19:18
@vsaw
Copy link
Collaborator Author

vsaw commented Dec 21, 2020

Got it working now. Apparently you can bypass GitHubs built in Jekyll, which the Action did (unknowingly).

For proof of work see:

See also https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/

@tdurand tdurand merged commit d900958 into opendatacam:development Dec 21, 2020
@vsaw vsaw deleted the 334-apidoc-on-build branch December 21, 2020 20:14
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.

None yet

2 participants