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

Configure Sphinx docs and Travis-CI deployment to GitHub Pages #90

Merged
merged 9 commits into from
May 11, 2018

Conversation

gnidan
Copy link
Contributor

@gnidan gnidan commented May 10, 2018

This PR has two parts:

  • Sphinx docs set-up
  • Deployment

Sphinx

Sphinx is an extensible docs generator. This PR enables extensions for:

Deployment

This PR sets up Travis deployment to gh-pages so that anyone who opens a PR can preview their changes. For instance: Preview this PR!

Included script ./bin/deploy checks out the gh-pages branch and copies the built docs output into the directory structure on that branch:

  • Builds directly on master copy to branch root, to resolve at ethpm.github.io/ethpm-spec/.
    (Note: this link won't work until this PR is merged)
  • Commits on other branches and PRs are placed in ./contrib/<remote-fork-name>/<branch-name>, to resolve at ethpm.github.io/contrib/<remote-fork-name>/<branch-name>.

To enable this, I have create a single-purpose deploy key with repository write-access, encrypted it with Travis's public key, and configured the CI build to hook everything up. For reference, I've adapted a process described in this gist.

Other Notes

  • Plug in validate.py into the Travis-CI build process, since that was previously not automated.
  • This PR doesn't actually contain docs yet, to keep this work isolated.

gnidan added 7 commits May 10, 2018 17:36
- Install requirements
- Validate examples
(Perhaps bad practice, but it's a point of failure for CI to download
this from SourceForge every time)
- Add Sphinx build directory to .gitignore
- Run `sphinx-quickstart`
- Enable useful extensions (for plantuml, jsonschema, et al.)
- Switch to sphinx_rtd_theme
@pipermerriam
Copy link
Member

pipermerriam commented May 10, 2018

I'd highly recommend using read-the-docs over gh-pages for hosting. They have solid facilities for building and hosting the docs, including multiple versions across multiple releases, etc. And you can get rid of that entire deploy script.

@gnidan
Copy link
Contributor Author

gnidan commented May 10, 2018

@pipermerriam I would prefer RTD also, but I have two concerns/questions:

  • It'd be nice to support previews of any contributor's changes before they are merged.
  • Can RTD run plantuml.jar for us, or more generally support custom themes and/or extensions?

It's been awhile since I've done research on the matter, but last I checked, this was lacking. Please advise!

@pipermerriam
Copy link
Member

pipermerriam commented May 10, 2018

It just support custom themes, extensions, and in general, custom builds. dunno about plantuml.jar but I suspect it's doable.

@gnidan
Copy link
Contributor Author

gnidan commented May 10, 2018

PlantUML is just there in case diagrams would be useful. It's certainly not a hard requirement. I just like diagrams. 🙃

I will research what the support is like with RTD these days. Thanks!

@pipermerriam
Copy link
Member

Also found this with some quick searching. https://plantweb.readthedocs.io/

@gnidan
Copy link
Contributor Author

gnidan commented May 10, 2018

Also found this with some quick searching. https://plantweb.readthedocs.io/

I'm aware of this tool, but it requires a PlantUML server. There's a public server, but I don't know about reliability, or any performance impact.

Anyway, it looks like there's an open issue readthedocs/readthedocs.org#407 for PlantUML support, but this RTD site seems to have it working (and from the looks of it, with the JAR self-hosted somehow? Unclear at first glance.)

UPDATE: Seems like it's supported out of the box now, and just undocumented? readthedocs/readthedocs.org#3885

@gnidan
Copy link
Contributor Author

gnidan commented May 10, 2018

@pipermerriam Do you feel strongly against GitHub Pages, or just strongly in favor of RTD?

If it's the latter, I propose this as an initial solution, since it works and is arguably not too complex; we can always switch when it becomes clear that this project needs a more mature solution like RTD.

@gnidan
Copy link
Contributor Author

gnidan commented May 10, 2018

For the other concern (the pre-merge previews), it seems like this is a requested feature, not yet available: readthedocs/readthedocs.org#2465

@pipermerriam
Copy link
Member

@gnidan I'll defer to you. All that really matters is that there is reliably hosted documentation that is up-to-date.

@gnidan
Copy link
Contributor Author

gnidan commented May 11, 2018

Thanks @pipermerriam. I am confident that this will suffice – Truffle's been using a similar GH pages build for almost a year without major problems.

Mind reviewing the implementation?

Also, anyone else have thoughts?

Copy link
Member

@pipermerriam pipermerriam left a comment

Choose a reason for hiding this comment

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

It may not matter, but the docs build is outputing an error: https://travis-ci.org/ethpm/ethpm-spec/builds/377497652#L566

I'm surprised that the conf.py isn't throwing errors since the travis build is in a python3 environment.

author = u'Piper Merriam, et al.'

# The short X.Y version
version = u''
Copy link
Member

Choose a reason for hiding this comment

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

This is python2 unicode string syntax. We should probably be using python3 which doesn't have the u prefix.

Copy link
Contributor

@njgheorghita njgheorghita left a comment

Choose a reason for hiding this comment

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

Looks good to me, I'm down with this GH pages setup - at least until we run into a reason to switch.
Maybe add a link to the docs at the top of the README?

@gnidan
Copy link
Contributor Author

gnidan commented May 11, 2018

Re: build error: I forgot to include .gitkeep for _static and _templates because they're empty right now. Fix that and the string syntax.

@njgheorghita We should probably wait to add this to the README, since the docs are totally empty. I figure, we can set up the link once we've moved the package.spec.md into Sphinx.

I'll merge this tomorrow assuming no objections. Thank you very much!

@gnidan gnidan merged commit 0f3adb6 into master May 11, 2018
@gnidan gnidan deleted the gnidan/sphinx branch May 11, 2018 16:55
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