Skip to content

chore(ci): check build memory against vercel machine size - #4657

Open
thetaPC wants to merge 2 commits into
mainfrom
build-memory-check
Open

chore(ci): check build memory against vercel machine size#4657
thetaPC wants to merge 2 commits into
mainfrom
build-memory-check

Conversation

@thetaPC

@thetaPC thetaPC commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Issue URL: N/A

What is the current behavior?

No workflow builds the site. CI.yml lints, runs tests, spellchecks, and checks translation keys, but never runs npm run build.

Vercel preview deployments do build, but build:preview is docusaurus build --locale en, so the Japanese locale is only ever built by production. That means nothing before a merge exercises the full build, and nothing measures how much memory it needs. There is no signal ahead of a release about whether the build still fits the Vercel build machine.

What is the new behavior?

Adds a manually triggered workflow that measures the full production build and compares it against the Vercel build machine the project is pinned to.

It builds all locales on Ubuntu, records peak memory with /usr/bin/time -v, and emits exactly one annotation:

Outcome Annotation
Fits notice, "Success! No action needed"
Too close to the ceiling error, "Move to {tier} before releasing"
Elastic selected warning, "Check the machine Elastic will assign"
Build did not finish warning, with the peak it reached before stopping

The machine tier is a dropdown input rather than a constant, and the capacities live in a single TIERS string that both the recommendation and the capacity lookup read, so correcting or adding a tier is one edit. Elastic is reported rather than checked, because it sizes each build from recent successful builds and has no fixed capacity to compare against.

The measurement log is uploaded as an artifact and the report step runs even when the build fails. GNU time writes its report before the command's exit status is known, so a build killed for running out of memory still leaves its peak in the log, which is the case where the number matters most.

Node is pinned to 24 to match production. engines.node is >=20.0.0, which overrides the Project Settings version and resolves to the latest 24.x per Vercel's mapping table.

Run it before a release. Adding a documentation version is what moves the number, so that is when the answer matters.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Why this exists. The v9 release pushed the production build past the 8 GB ceiling of Vercel's Standard machine, and three consecutive production deploys were killed partway through the Japanese locale. Preview builds stayed green throughout, because they only build English, which is the gap this workflow closes.

@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-docs Ready Ready Preview Aug 24, 2026 6:01pm

Request Review

@thetaPC
thetaPC marked this pull request as ready for review August 20, 2026 23:33
@thetaPC
thetaPC requested a review from a team as a code owner August 20, 2026 23:33
@thetaPC
thetaPC requested a review from BenOsodrac August 20, 2026 23:33

@ShaneK ShaneK 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.

Nice piece of work, and the reasoning in the comments is great

Comment thread .github/workflows/build-memory.yml Outdated
# Smallest fixed tier this build fits on under the threshold. Falls
# back to Turbo, the largest, when nothing fits.
RECOMMENDED=$(awk -v peak="$PEAK_GB" -v t="$THRESHOLD_PCT" 'BEGIN {
split("Standard:8 Enhanced:16 Turbo:60", tiers, " ")

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.

The PR description says there's no hardcoded capacity to keep up to date, but the dropdown only carries the tier name. The capacities are literals here and again in the case below, and the tier count is hardcoded a third time as the i <= 3 bound.

The values are all correct against Vercel's current specs, so nothing's wrong today. It's the next change I'd worry about: patching the case but not this string gives you a correct pass or fail with the wrong recommendation, and adding a fifth option to the dropdown would fall through to Turbo without anyone noticing. Could both halves read one shared tier table instead? Worth fixing the claim in the PR body too, since that's what someone reads first when they come to update it.

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.

run: /usr/bin/time -v -o build-memory.log npm run build
shell: bash

- name: 📊 Report Against Machine Capacity

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 step has no if:, so it inherits success() and gets skipped whenever the build fails, and build-memory.log isn't uploaded anywhere so it goes away with the runner.

That's worth keeping, because the log still has the number in it. GNU time writes its whole report before working out its own exit status, so an OOM-killed build leaves the peak RSS in the log with a Command terminated by signal 9 line in front of it, and exits 137. The awk match already tolerates that preamble. So if: always() plus an upload-artifact step would get you the figure in the case where it's least ambiguous.

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.

Comment thread .github/workflows/build-memory.yml Outdated
- name: ⚙️ Use Node.js 20
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 20

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 think Vercel is building this on Node 24, not 20. Their docs say engines.node overrides whatever's picked in Project Settings, and their mapping table puts >=20.0.0 in the 24.x row, resolving to the latest 24.x. This repo's package.json declares exactly that.

If that's right, the measurement is on a different major than production, and GC behavior moves between majors enough to undercut the comparison. The quick fix is node-version: 24. A committed .nvmrc that both this workflow and Vercel read would be the durable one, since there's no .nvmrc or Volta pin right now.

@thetaPC thetaPC Aug 24, 2026

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.

c4857cc

.nvmrc wouldn't help though, Vercel's build only reads Project Settings and engines.node, so node-version-file: package.json is the durable version if we want it.

Aligning the repo's Node version with Vercel's is on my todo. It's waiting on the dependency updates already in flight, since a lot of packages here are out of date.

Comment thread .github/workflows/build-memory.yml Outdated
split(tiers[i], tier, ":")
if (peak / tier[2] * 100 <= t) { print tier[1]; exit }
}
print "Turbo"

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.

Nit: when nothing fits under the threshold this prints Turbo, which is also the largest tier, so on Turbo you'd get "Move to Turbo before releasing", and the Elastic warning would say the build fits on Turbo when it doesn't. It needs a peak over 45 GB to get here, so it's out of reach on a 16 GB runner today. A distinct "nothing fits" value would stop the message claiming a fit that isn't there, but up to you, this is cosmetic while the runner is the ceiling.

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.

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