Skip to content

Size the node heap from runner RAM in setup-pnpm - #42

Merged
goastler merged 2 commits into
mainfrom
setup-pnpm/node-heap
Nov 7, 2026
Merged

goastler merged 2 commits into
mainfrom
setup-pnpm/node-heap

Conversation

@goastler

@goastler goastler commented Nov 6, 2026

Copy link
Copy Markdown
Member

What changed

  • setup-pnpm now sets NODE_OPTIONS=--max-old-space-size to 75% of the runner's total RAM (new node-heap-percent input). It appends to any existing NODE_OPTIONS, and if the caller already set a heap size, that value wins.
  • New node_heap.py reads RAM on Linux, macOS and Windows. If it can't read RAM it prints a warning and leaves things unchanged, so the step never fails a job.
  • Removed NODE_OPTIONS=4096 from ci.yml. A workflow's env doesn't pass into the workflows it calls, and none of its own jobs run node, so the line did nothing.

Effect

  • Every job using setup-pnpm gets a heap that fits its machine: no more "JavaScript heap out of memory" at node's default heap size, and no OOM-killer from a fixed 8192 on a 7 GB runner.
  • The computed value is printed in the step log.

Tests

  • test_node_heap.py: 9 tests (sizing, appending, caller value wins, meminfo parsing, unreadable RAM). These run in CI through run_python_tests.py.
  • ruff, shellcheck of composite steps, actionlint and workflow-lint pass.
  • actions-selftest.yml exercises setup-pnpm on ubuntu and macOS.

@goastler
goastler merged commit b78b377 into main Nov 7, 2026
83 checks passed
@goastler
goastler deleted the setup-pnpm/node-heap branch November 7, 2026 00:18
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.

1 participant