Skip to content

Remove dependency used for counting available CPUs#78593

Merged
desrosj merged 1 commit into
trunkfrom
remove/external-action-for-counting-cpu-cores
May 22, 2026
Merged

Remove dependency used for counting available CPUs#78593
desrosj merged 1 commit into
trunkfrom
remove/external-action-for-counting-cpu-cores

Conversation

@desrosj
Copy link
Copy Markdown
Member

@desrosj desrosj commented May 22, 2026

What?

This removes the SimenB/github-actions-cpu-cores action 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.

@desrosj desrosj self-assigned this May 22, 2026
@desrosj desrosj marked this pull request as ready for review May 22, 2026 19:30
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 22, 2026

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: desrosj <desrosj@git.wordpress.org>
Co-authored-by: johnbillion <johnbillion@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@desrosj desrosj requested a review from Copilot May 22, 2026 19:31
@desrosj desrosj added [Type] Build Tooling Issues or PRs related to build tooling GitHub Actions Pull requests that update GitHub Actions code labels May 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-cores action steps from the unit test workflow jobs.
  • Replaced use of the action output (steps.cpu-cores.outputs.count) with $(nproc) when passing --maxWorkers to Jest runs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

Flaky tests detected in 826d9f0.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/26307760071
📝 Reported issues:

Copy link
Copy Markdown
Member

@johnbillion johnbillion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@desrosj desrosj merged commit 4d02abd into trunk May 22, 2026
54 of 56 checks passed
@desrosj desrosj deleted the remove/external-action-for-counting-cpu-cores branch May 22, 2026 20:13
@github-actions github-actions Bot added this to the Gutenberg 23.3 milestone May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GitHub Actions Pull requests that update GitHub Actions code [Type] Build Tooling Issues or PRs related to build tooling

Projects

Development

Successfully merging this pull request may close these issues.

3 participants