-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
Add deploy preview for docs #82041
Comments
It would be good to preview the cpython documentation on PRs using Netlify. |
Given Ernest's comment in #15288 (comment) about the limitations of Netlify (1000 build minutes per month), it doesn't seem like Netlify will be a viable alternative. Instead, I've added a PR (#19025) that takes an alternative approach. It uses GitHub Actions to deploy the docs to the gh-pages branch, then adds a comment to the PR with a link to the deploy preview. The way this works is that the gh-pages branch has subfolders with the SHA of each commit, and each deploy preview is deployed to each subfolder. I've enabled this on my fork of cpython -- here's an example PR on my fork: epicfaace#7 |
GitHub Pages has no limit on "build limits" like Netlify does. One limitation of this approach, though, is that GitHub Pages sites are limited to 1 GB in size. Each doc build is 50 MB, meaning that we could host at a maximum 20 builds. If we needed to, we could resolve this by doing one (or multiple) of the following:
|
My preference would be to have a "preview-with-netlify" label that could be manually added to use the netlify preview on a case-by-case basis. There are a substantial number of trivial PRs (such as typo fixes and similar minor changes) that are automatically labelled as "documentation" which wouldn't particularly benefit from the netlify preview and would needlessly occupy part of the limit. Personally, I feel that it most largely benefits more significant documentation changes that involve modification of existing markup or the addition of new markup, rather than all documentation PRs. So a manually added label to trigger it makes the most sense to me. This would be very similar to the recently added "test-with-buildbots" label. |
+1, It would be so much useful in cases like GH 19928. |
I realized there's another alternative which is probably simpler. We can use Netlify to host the deploy previews, but we can use GitHub Actions to build the documentation. This way, we won't run into the build time limits for Netlify, and we can still use Netlify to host deploy previews. We can use this GitHub Actions action: https://github.com/marketplace/actions/netlify-actions, and just add it as an additional step to our existing doc GitHub Actions workflow (https://github.com/python/cpython/blob/master/.github/workflows/doc.yml). What do you think about this approach? |
@epicfaace Hi again! Building on GitHub Actions and deploying to Netlify definitely sounds promising and definitely worth a try! Like you say, we're already building the docs in our own workflow and so it would be good to see how long the upload takes. |
I looked into the Netlify action, but there's a blocker; it requires a Netlify personal access token / https://github.com/nwtgck/actions-netlify#required-inputs-and-env And GitHub doesn't make secrets available to PRs from forks, which unfortunately would limit us to uploads only for core devs and only when they created a branch in this repo. I guess we could hardcode the token without using secrets, but that doesn't sound like a great idea. Another option, Read the Docs can now build previews for PRs: https://docs.readthedocs.io/en/stable/pull-requests.html We're using for PR previews in the PEPs repo, even though the main site is hosted elsewhere (on GitHub Pages). For example:
As a demo, I've set it up for my fork:
I would recommend naming it something like (See also python/docs-community#5 for hosting the live docs on RTD, which is another but related matter. This could be a first step towards that.) Thoughts on using RTD for PR previews? |
Why do you want to build on GitHub Actions? Netlify provides its own building compute (similar to RTD) and has an open source plan that CPython would qualify for: https://www.netlify.com/legal/open-source-policy/. The build is configured by specifying a build command and a publish directory -- https://docs.netlify.com/configure-builds/overview/?#basic-build-settings. Netlify has deploy previews functionality baked into their offering: https://docs.netlify.com/site-deploys/deploy-previews/ |
@pradyunsg See #82041 (comment) and #15288 (comment): We have a Pro level open source plan on Netlify, but the limits of 1,000 build minutes per month likely aren't enough. But wait! That was in January 2000 and it now looks like there's 25k minutes per month! If the estimates in #15288 (comment) are still accurate, that would give us something like 4,250 builds per month. There were 660 PRs created last month, a few would have multiple builds (and some older PRs would have builds too), but I expect 4k builds should be plenty. |
Let's do it then! |
@hugovk @pradyunsg I added a PR in #92852. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: