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

Continuous Documentation #344

Merged
merged 6 commits into from
Oct 15, 2019

Conversation

weiji14
Copy link
Member

@weiji14 weiji14 commented Oct 11, 2019

Description of proposed changes

Making it easier to preview documentation changes in Pull Requests via 'Continuous Documentation'. Currently deployed to serverless infrastructure on Zeit Now.

Zeit Now is meant to be a zero-config/serverless, but that's for the javascript world. I've hacked the package.json to get sphinx and pygmt up and running to build the docs. The static files are then copied to a public folder where it gets deployed automatically to a url that looks like pygmt-abcdef.now.sh. You can see an example at https://pygmt-l8nmyn8mx.now.sh/.

Merge after #343, Fixes #342

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

Continuous documentation made on every push made to the repository. Sets up miniconda first, installs the necessary packages, builds the documentation pages and then deploys website to Zeit Now static site host.
@vercel
Copy link

vercel bot commented Oct 12, 2019

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/gmt/pygmt/119cxm068
🌍 Preview: https://pygmt-git-fork-weiji14-continuous-docs.gmt.now.sh

@weiji14 weiji14 marked this pull request as ready for review October 12, 2019 02:09
@weiji14
Copy link
Member Author

weiji14 commented Oct 12, 2019

Ok, this is almost ready! Previews of the website can be viewed by clicking on the 'View deployment' button:
image

The bot is a lot noisier than I expected, but I've toggled on a silent flag that should 🤞 stop it from commenting on Pull Requests and commits once this PR is merged in.

Another thing worth considering is the related Deploy Summary Integration app (see review) that would detect changes to the pages and post a screenshot and direct link to the said changes. This will need to be installed (and might add more noise to our PRs) so looking to see what everyone thinks.

@weiji14 weiji14 requested a review from a team October 13, 2019 21:39
@leouieda
Copy link
Member

@weiji14 thanks for taking the time! This looks really cool. Is the now service building the docs or are they being deployed from the CI? Since all our CIs build the docs anyway, would it be easier to deploy from there? The problem is that keep these build systems alive takes quite a bit of time and effort, so it would be good to explore all options before adding a new one.

@weiji14
Copy link
Member Author

weiji14 commented Oct 14, 2019

@weiji14 thanks for taking the time! This looks really cool. Is the now service building the docs or are they being deployed from the CI?

Yes, the now service is building them using npm.

Since all our CIs build the docs anyway, would it be easier to deploy from there? The problem is that keep these build systems alive takes quite a bit of time and effort, so it would be good to explore all options before adding a new one.

I hinted at #342 (comment) that this is indeed possible, but would require setting a token/secret variable. We could probably disable those documentation builds in a separate PR to speed them up?

The thing is, each of the built documentation sites have to be hosted online somewhere and given a unique url, which none of our current CIs are able to provide. Github Pages does do a build but is limited to one url. Another option I've looked at is netlify that does CD as well, but their pricing structure isn't as good as Now's.

@phloose
Copy link
Contributor

phloose commented Oct 14, 2019

Slightly off-topic but have you guys ever thought of migrating to gitlab? They have the possibility of ci/cd stuff directly built in so that you don't have to use different external apps that one has to somehow connect to... And the most important part: a single point of maintenance! Have a look here: https://docs.gitlab.com/ee/ci/introduction/index.html

@leouieda
Copy link
Member

We could probably disable those documentation builds in a separate PR to speed them up?

I’m not too keen on that since he docs builds are a sort of test. But to all builds need to do this (probably only one per OS would be good).

The thing is, each of the built documentation sites have to be hosted online somewhere and given a unique url, which none of our current CIs are able to provide. Github Pages does do a build but is limited to one url. Another option I've looked at is netlify that does CD as well, but their pricing structure isn't as good as Now's.

And using a key won’t work for forks because they aren’t decrypted for these builds (rightly so). But there are ways of storing build artefacts in Azure and Travis (which could be the html).

have you guys ever thought of migrating to gitlab

Yes but the problem is that everyone is here on GitHub, which makes it much easier to recruit contributors. But it is tempting.

@weiji14
Copy link
Member Author

weiji14 commented Oct 15, 2019

Agreed that the documentation builds (which creates figures) does provide provide some 'integration' testing. Also with the Gitlab argument, Github does have Github Actions now which can be used to do CI/CD, but again, this topic is getting sidetracked too much...

Are there any outstanding issues with this PR @leouieda, or is it ready for approval/merge? I'm actually waiting to get this merged in to start working on some gallery examples. The workshop is coming up soon...

@leouieda
Copy link
Member

@weiji14 would you mind inserting some comments in the two files included here about what they are? Also, did this setup require signing up for these services? If so, were they done with your personal account? Would you mind posting some more information about this here so we can I have a record in case someone else need to manage this in the future? One thing we want to avoid is having a single person be able to access/manage things (which reminds me, we need to add you to Azure and PyPI).

@leouieda
Copy link
Member

Sorry for holding this up but PRs are meant for discussion before we commit to a given feature. It’s much easier to add things than it is to remove them later (granted, not in the case of this PR). I want to encourage a culture of deeper discussion of things before giving the 👍 and merging, even if that means going a bit slower in PyGMT than GMT core.

@weiji14
Copy link
Member Author

weiji14 commented Oct 15, 2019

No don't apologize! I totally understand from a maintenance point of view (having worked on >10 year old legacy code before). A quick search shows that it isn't easy to add comments json files (see https://stackoverflow.com/questions/244777/can-comments-be-used-in-json) but I'll look around a bit more.

In terms of the Now account setup, I've set up a 'gmt' organization and I'm currently the 'owner', with @seisman being an user. I'll send an invite to your email too actually. Edit: I've set you two up with 'owner' permissions.

@leouieda
Copy link
Member

@weiji14 i thought that might be the case. Don’t worry too much about it. What you can do is include a section in MAINTENANCE.md which briefly explains the setup, files involved, and links to services so we can easily find them.

MAINTENANCE.md Show resolved Hide resolved
Copy link
Member

@leouieda leouieda left a comment

Choose a reason for hiding this comment

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

👍 @weiji14 looks good to me!

As a side note: when you merge a PR, please edit the commit message. Remove the messages from irrelevant commits and make a condense it into a good descriptive message (and title) so we can easily track things in the history. See the commit message for this PR as an example. cc @seisman

@leouieda leouieda merged commit cdcdf70 into GenericMappingTools:master Oct 15, 2019
@weiji14 weiji14 deleted the continuous-docs branch October 15, 2019 20:01
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.

Automated documentation previews in pull requests
3 participants