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

Use Netlify to build documentation preview for PRs #2646

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Oct 1, 2024

Motivation

Currently, to review a documentation change, one needs to:

  1. Pull the change and checkout to it with gh command
  2. Run cd jekyll
  3. Run bundle exec jekyll serve

And it's assuming that Jekyll is already installed to the latest version locally.

If we can have a way to preview the doc changes directly, it'd be much easier for maintainers and anyone who's interested in the changes to review. And hopefully lowering the reviewing costs can also make doc contribution (feel) easier.

Implementation

  1. Use Ruby 3.3.3 for jekyll folder. I explained more in the comments below.
  2. Add netlify.toml to store all build configurations.

With the build ignore config in place, Netlify's free plan should cover our current usages.

Automated Tests

Manual Tests

Copy link

netlify bot commented Oct 1, 2024

Deploy Preview for ruby-lsp ready!

Name Link
🔨 Latest commit ba4b2b0
🔍 Latest deploy log https://app.netlify.com/sites/ruby-lsp/deploys/66fc577306886c0008babe78
😎 Deploy Preview https://deploy-preview-2646--ruby-lsp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@st0012 st0012 force-pushed the integrate-with-netlify branch 9 times, most recently from 2b5284b to aa76659 Compare October 1, 2024 18:06
@st0012 st0012 added the chore Chore task label Oct 1, 2024
Because Netlify uses rvm, Ruby 3.3.4+ currently fails to build on its
containers due to:

- ruby/bigdecimal#297
- rubygems/rubygems#8015

And because Netlify doesn't allow installing apt packages, we can't
address the issue to make the install succeed. So instead, we need to
use a version of Ruby that can be built on Netlify's containers.
@@ -1 +0,0 @@
../.ruby-version
Copy link
Member Author

Choose a reason for hiding this comment

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

We need to stay 3.3.3 for now because Netlify uses rvm, which Ruby 3.3.4+ currently fails to build on its
containers due to:

And because Netlify doesn't allow installing apt packages, we can't address the issue to make the install succeed. So instead, we need to use a version of Ruby that can be built on Netlify's containers.


# Set the baseurl to "/" and url to "$DEPLOY_PRIME_URL" so that the built site is served from the root
command = """
printf "url: \"$DEPLOY_PRIME_URL\"\nbaseurl: \"/\"" > _config_netlify.yml; \
Copy link
Member Author

Choose a reason for hiding this comment

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

Since we want to build new sites for PR preview, the url will vary PR by PR. So this line is needed to dynamically generate suitable Jekyll configs for Netlify.
And because it needs to be dynamic, it can't be a committed _config_netlify.yml file.

@st0012 st0012 marked this pull request as ready for review October 1, 2024 20:24
@st0012 st0012 requested a review from a team as a code owner October 1, 2024 20:24
@st0012 st0012 changed the title Add minimum netlify.toml Use Netlify to build documentation preview for PRs Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Chore task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants