Skip to content

CI Build Docs Improvements#4014

Merged
fire-at-will merged 5 commits into
mainfrom
run-docs-on-xcode14
Jul 2, 2024
Merged

CI Build Docs Improvements#4014
fire-at-will merged 5 commits into
mainfrom
run-docs-on-xcode14

Conversation

@fire-at-will

@fire-at-will fire-at-will commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

Motivation

The doc building process can be fragile at times, and since we only build the docs when we make a deployment, we can be unaware when changes in individual PRs can break our docs' build. This PR aims to make changes that break the docs building process visible earlier in the development cycle to help avoid tricky failures during deployments.

Description

This PR makes two main changes to how docs are built in the CI process:

  • Fixes the existing docs job in the deploy pipeline by having it run on Xcode 14.3.0. This fix comes from an earlier commit by @vegaro that likely got overridden when 5.0-dev was merged into main recently.
  • Introduces a job to build the docs on each PR instead of only during the deploy pipeline
    • It splits the existing docs-build into two separate jobs:
      • docs-build: Only builds the docs, and is run on each build.
      • docs-deploy: Builds and deploys the docs. Replaces the old docs-build job and is only run in the deploy pipeline.
    • In Fastlane, we've split the existing generate_docs lane into two separate lanes and one private lane:
      • generate_docs: This now only builds the docs by running the generate_docs_shared lane
      • generate_and_publish_docs: Builds the docs by running the generate_docs_shared lane and then publishing the docs

Testing

I've been able to test the docs-build job in this PR, but haven't been able to fully test the generate_and_publish_docs job since we haven't executed another deployment since 5.0.0. If anyone has any ideas to test generate_and_publish_docs, let me know! 😄

@fire-at-will fire-at-will added the ci label Jul 2, 2024
@fire-at-will fire-at-will requested review from a team, joshdholtz and vegaro July 2, 2024 19:02
@fire-at-will fire-at-will marked this pull request as ready for review July 2, 2024 19:02
Comment thread fastlane/Fastfile Outdated
Comment on lines +819 to +820
desc "Builds the docs"
private_lane :generate_docs_shared do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nitpick: I'd call this one "build docs" and the other one "build_and_deploy" to reuse the language from other lanes

Also, having generate_docs be the one that both builds and deploys was not my brightest naming moment, feel free to rename

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done! We now have the public lanes build_docs and build_and_publish_docs, and a private lane build_docs_shared.

Comment thread fastlane/Fastfile
Comment on lines +796 to +804
Dir.mktmpdir do |docs_repo_clone_dir|
Dir.chdir(docs_repo_clone_dir) do
sh("git", "clone", docs_repo_url)
Dir.chdir(docs_repo_name) do
# copy docs generated in the previous step into the docs folder
# and push the changes
docs_destination_folder = "docs/#{version_number}"
FileUtils.cp_r @docs_generation_folder + "/.", docs_destination_folder
docs_files.each do |file|

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd forgotten about this particular rube goldberg machine

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is definitely one where ChatGPT helped me understand it 100% times faster :D

@joshdholtz joshdholtz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good! Just some improvement on some Ruby return values

Comment thread fastlane/Fastfile Outdated
hosting_base_path = File.join(docs_repo_name, version_number)

Dir.mktmpdir do |docs_generation_folder|
@docs_generation_folder = docs_generation_folder

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd prefer not to use a local variable here if possible 😇 I'd just return this value out of all of these blocks

private_lane :build_docs_shared do
  docs_path = Dir.mktmpdir do |docs_generation_folder|
    # do the stuff

    docs_generation_folder # returning path from block
  end

  docs_path # returning path from lane
end

lane :build_and_publish_docs do
    docs_generation_folder = build_docs_shared
    # do stuff
end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Love this, done! :D

@joshdholtz joshdholtz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good! :shipit:

@fire-at-will fire-at-will merged commit 99f684d into main Jul 2, 2024
@fire-at-will fire-at-will deleted the run-docs-on-xcode14 branch July 2, 2024 21:34
joshdholtz added a commit that referenced this pull request Jul 16, 2024
**This is an automatic release.**

### New Features
* Paywalls with custom purchase and restore logic handlers (#3973) via
James Borthwick (@jamesrb1)
### Bugfixes
* Prevent paywall PurchaseHandler from being cleared on rerender (#4035)
via Josh Holtz (@joshdholtz)
* Update Purchase Tester for 5.0.0 (#4015) via Will Taylor
(@fire-at-will)
### Dependency Updates
* Bump fastlane from 2.221.0 to 2.221.1 (#3977) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* Bring official `xcodes` back to CI (#4029) via Cesar de la Vega
(@vegaro)
* Paywalls tester with sandbox purchases (#4024) via James Borthwick
(@jamesrb1)
* Update v5 migration guide to contain current latest version (#4019)
via Toni Rico (@tonidero)
* CI Build Docs Improvements (#4014) via Will Taylor (@fire-at-will)
* Use available resource class for backend-integration-tests-offline-job
(#4013) via Will Taylor (@fire-at-will)
* Add `X-Preferred-Locales` header (#4008) via Cesar de la Vega
(@vegaro)

---------

Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com>
Co-authored-by: Josh Holtz <me@joshholtz.com>
nyeu pushed a commit that referenced this pull request Oct 2, 2024
**This is an automatic release.**

### New Features
* Paywalls with custom purchase and restore logic handlers (#3973) via
James Borthwick (@jamesrb1)
### Bugfixes
* Prevent paywall PurchaseHandler from being cleared on rerender (#4035)
via Josh Holtz (@joshdholtz)
* Update Purchase Tester for 5.0.0 (#4015) via Will Taylor
(@fire-at-will)
### Dependency Updates
* Bump fastlane from 2.221.0 to 2.221.1 (#3977) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* Bring official `xcodes` back to CI (#4029) via Cesar de la Vega
(@vegaro)
* Paywalls tester with sandbox purchases (#4024) via James Borthwick
(@jamesrb1)
* Update v5 migration guide to contain current latest version (#4019)
via Toni Rico (@tonidero)
* CI Build Docs Improvements (#4014) via Will Taylor (@fire-at-will)
* Use available resource class for backend-integration-tests-offline-job
(#4013) via Will Taylor (@fire-at-will)
* Add `X-Preferred-Locales` header (#4008) via Cesar de la Vega
(@vegaro)

---------

Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com>
Co-authored-by: Josh Holtz <me@joshholtz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants