Skip to content

ci: fast docs format check for docs-only PRs#2028

Open
fengmk2 wants to merge 10 commits into
mainfrom
ci/docs-fmt-check
Open

ci: fast docs format check for docs-only PRs#2028
fengmk2 wants to merge 10 commits into
mainfrom
ci/docs-fmt-check

Conversation

@fengmk2

@fengmk2 fengmk2 commented Jul 3, 2026

Copy link
Copy Markdown
Member

Since #1991, docs-only PRs skip the full CI matrix, so nothing format-checks markdown (vp check in cli-e2e-test only runs for code changes). As suggested in this comment, add a fast docs-fmt job that runs vp fmt --check when code-changed == 'false'.

How it stays fast (about 15s total on the runner, the check itself is about 5s for 1,879 files):

  • setup-vp installs the released Vite+ (version: latest, since the workspace vite-plus version can be ahead of the registry) with run-install: false.
  • vp fmt needs the root vite.config.ts to load, and its runtime import ... from 'vite-plus' must resolve. Instead of installing the whole workspace (which also needs the vite/rolldown subrepo clones), the job symlinks the released vite-plus package out of the global install into node_modules/.
  • Checks the whole repo, so root markdown (README, RFCs) is covered too, matching the **/*.md part of the CI skip filter.

Non-blocking as suggested: the job is not listed in the done job's needs.

Verified on this PR by temporarily lifting the skip condition (middle commits, since ci.yml itself is a code change the job would otherwise skip here):

The final commit restores the code-changed == 'false' guard, so the job is expected to be skipped on this PR itself.

fengmk2 added 2 commits July 3, 2026 11:12
Since #1991, docs-only PRs skip the full CI matrix, so nothing
format-checks markdown: the only formatting check (vp check in
cli-e2e-test) never runs for them.

Add a docs-fmt job that runs only when code-changed is false. It
installs the released Vite+ via setup-vp (version pinned to latest
because the workspace vite-plus version can be ahead of the registry)
and runs vp fmt --check over the whole repo, covering docs/** and all
root markdown. Loading the root vite.config.ts needs the runtime
'vite-plus' import to resolve, so the job links the released package
out of the global install instead of installing the workspace, which
keeps the job under a minute.

Non-blocking by design: the job is not listed in the done job's needs.

Ref: #1991 (comment)
Temporarily lift the code-changed == 'false' condition (this PR edits
ci.yml, so the job would otherwise be skipped here) and add an
intentionally misformatted canary file. Revert this commit before merge.
@netlify

netlify Bot commented Jul 3, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 3442108
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a477c5b612f9b0008299124

fengmk2 added 2 commits July 3, 2026 11:16
Second half of the demo: with the misformatted file gone, the
docs-fmt job should now go green on this PR. The lifted skip
condition still needs to be restored before merge.
Both demo runs are linked from the PR: the job failed on the canary
file and passed after its removal. With the guard back, docs-fmt only
runs when code-changed is false.
@fengmk2 fengmk2 marked this pull request as ready for review July 3, 2026 03:18
@fengmk2 fengmk2 requested a review from wan9chi July 3, 2026 03:25
Comment thread .github/workflows/ci.yml
fengmk2 added 5 commits July 3, 2026 11:33
vp resolves oxfmt project-first (process.cwd() before its own bundled
copy), so installing the pnpm catalog's pinned oxfmt and linking it
into node_modules makes the check follow the repo's real formatter
version instead of whatever the released vite-plus bundles. The two
match today (0.57.0), but the pin protects against drift in either
direction.

oxfmt loads the fmt block from vite.config.ts itself and resolves the
config's vite-plus import from its own realpath, so the temp install
also gets a vite-plus sibling link.
cli-e2e-test (linux) already bootstraps the global CLI from source on
every main push, so snapshot that install (before the upgrade/implode
tests mutate it) into an actions cache keyed by commit. docs-fmt
restores the newest main build and runs its local CLI, so docs-only
PRs are checked with a vp built from the same code they are based on.

When no cache is available (cold repo, evictions), the job falls back
to the released vite-plus from setup-vp, which also provides Node.js
for the local CLI in both paths. The repo-pinned oxfmt overlay stays,
so the formatter version always follows the PR's own catalog pin
either way.
Lift the docs-fmt skip condition and the main-only cache save so both
paths can be observed here: the first run falls back to the released
vp (no cache yet), and a docs-fmt rerun after cli-e2e-test (linux)
completes restores the branch cache. Reverted before merge.
The dev global install is not relocatable: install-global-cli wires
local-dev installs by symlinking node_modules/vite-plus to the
workspace packages/cli and transitive deps into its node_modules, so
caching ~/.vite-plus/current captures a 4 MB skeleton of dangling
symlinks (verified on this PR: the saved cache was 4 MB instead of
~160 MB). Making it self-contained would require a release-style
pack-and-install pipeline, which is not worth it for a format check
whose formatter version is already pinned via the oxfmt overlay.

Back to the released vp launcher with the repo-pinned oxfmt.
The released vite-plus bundles the oxfmt it was tested with (currently
the same 0.57.0 the repo pins), and the formatter rarely changes
behavior between releases. If version drift ever produces confusing
results here, the project-first overlay from 9adcc4c can be brought
back.
@fengmk2 fengmk2 requested a review from cpojer July 3, 2026 06:07
@fengmk2 fengmk2 self-assigned this Jul 3, 2026
Comment thread .github/workflows/ci.yml
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.

2 participants