Optimize Quarto build: remove R, cache Python docs, exclude _source, scope lightbox#1176
Optimize Quarto build: remove R, cache Python docs, exclude _source, scope lightbox#1176
Conversation
…, exclude _source, scope lightbox - Remove unused R setup from all 3 deploy workflows (0 R code blocks exist) - Cache Python API docs by validmind-library SHA (skip Poetry+install on cache hit) - Cache Quarto _site/_freeze/.quarto output with config-aware cache keys - Add execute: false + freeze: true globally to prevent accidental notebook execution - Add render: ['!_source/'] to exclude cloned repos from Quarto project scan - Disable lightbox globally, enable only on 21 pages that actually use it Co-authored-by: amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019c6ed2-7b81-763a-a6f8-0df84b9b6531
868ac17 to
35c5d6e
Compare
…ptimize-quarto-build-performance
PR SummaryThis pull request introduces enhancements to the documentation deployment pipelines by adding caching mechanisms to improve build performance. Specifically, the changes add new steps in three GitHub Actions workflows (for production, staging, and validation) to:
Additionally, the pull request makes updates to the Quarto configuration files to adjust the These improvements aim to reduce build times by reusing cached resources and ensuring that documentation output is only regenerated when necessary. Test Suggestions
|
Validate docs site✓ INFO: A live preview of the docs site is available — Open the preview |
Lighthouse check resultsShow Lighthouse scoresFolder depth level checked: 0 Commit SHA: 9beb601 Modify the workflow to check a different depth:
|
There was a problem hiding this comment.
I much appreciate the idea of making our Quarto renders faster, so thank you for this PR in principle. 💖.
I need to scrape out recently added but unused media out of the release-notes repo history with filter-repo again as it's skewing build times, but not building the Python docs every time seems to shave off about 2' 30". Nice!
Cache Quarto site output — _site/, _freeze/, and .quarto/ are cached with config-aware keys so incremental renders are faster on subsequent runs.
Given this saves all of 6", I would be inclined to remove this part or we need to test more. There is a known limitation for incremental renders with quarto preview where updated _*.qmd files and pages with listings are not re-rendered on update but I'm not sure how your workflow changes would behave here.
The lightbox: false global default
This breaks the release notes where we currently let users expand thumbnails of screenshots (26.03 PR example vs 26.03 prod example). We either need to allow lightbox for release notes or undo this change.
The _source/ exclusion via render: ["!_source/"] means Quarto won't attempt to render files in that directory
AFAIK, Quarto automatically ignores files and directories that start with _ unless explicitly embedded, so I don't think this change does anything?
(FYI, the validate workflow in this PR required Beck's changes in main that removed our old breaking changes page (the one that had the R dependency), should be sorted now.)
Pull Request Description
What and why?
The Quarto docs build takes ~23 minutes. This PR applies 6 optimizations to dramatically reduce build time:
.qmdfiles use{r}code blocks. Pure waste (~2-3 min saved).validmind-libraryis installed via Poetry and 183.qmdfiles are generated every build. Now cached and skipped on cache hit (~5-8 min saved)._site/,_freeze/, and.quarto/are cached with config-aware keys so incremental renders are faster on subsequent runs.execute: false+freeze: trueglobally — No execute/freeze config existed, risking accidental notebook execution during render._source/from Quarto project scan — 3 repos are cloned inside the Quarto project dir; Quarto was walking/scanning all their files unnecessarily.lightbox: trueglobally — Was enabled on all ~660 pages but only 21 actually use it. Now enabled only where needed (viatraining/_metadata.ymland 2 individual page frontmatters).All 3 deploy workflows (prod, staging, PR preview) are updated consistently.
How to test
validate-docs-siteworkflow will run with all optimizations_sourceexclusion + lightbox scopingWhat needs special review?
execute: false+freeze: truechange — confirm no pages currently rely on live code execution during render (audit found 0{r},{python}, or{julia}blocks in any.qmdfiles)lightbox: falseglobal default — verify training pages and the 2 individual pages (conventions.qmd,2024-dec-06/release-notes.qmd) still show lightbox correctlyDependencies, breaking changes, and deployment notes
_source/exclusion viarender: ["!_source/"]means Quarto won't attempt to render files in that directory (they were never meant to be rendered directly anyway)Release notes
Internal build performance improvement — no user-facing changes.
Checklist