Remove dependency used for counting available CPUs#78593
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
This PR removes the third-party SimenB/github-actions-cpu-cores GitHub Action from the Unit Tests workflow and replaces it with the built-in nproc command to determine CPU core count for Jest’s --maxWorkers on Linux runners, reducing supply-chain dependencies.
Changes:
- Removed the
SimenB/github-actions-cpu-coresaction steps from the unit test workflow jobs. - Replaced use of the action output (
steps.cpu-cores.outputs.count) with$(nproc)when passing--maxWorkersto Jest runs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Flaky tests detected in 826d9f0. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/26307760071
|
johnbillion
left a comment
There was a problem hiding this comment.
Runs with maxWorkers set to 4, same as it is in trunk.
npm run --workspace @wordpress/unit-tests test:unit -- --ci --maxWorkers=4 --shard=1/4 --cacheDirectory=/home/runner/.jest-cache
What?
This removes the
SimenB/github-actions-cpu-coresaction as a dependency.Introduced in 5571a79 by way of #59904.
Why?
The action sets the result of a single expression as an output for future steps to make use of.
With supply chain attacks occurring more and more frequently, it's in the project's best interest to limit the number of dependencies a repository has as much as possible. This is a good example of "a dependency for dependency's sake" as it can be replaced with a single simple command.
How?
Since every job using this action is Linux-based, the same can be accomplished using
nproc.Use of AI Tools
I used Claude to analyze how the dependency is used within the repository and evaluate whether it can safely be removed in favor of a simpler solution.