github-actions-cpu-cores icon indicating copy to clipboard operation
github-actions-cpu-cores copied to clipboard

Why not just nproc?

Open idealo-ricardo-band opened this issue 2 years ago • 2 comments

$ nproc --help
Usage: nproc [OPTION]...
Print the number of processing units available to the current process,
which may be less than the number of online processors

Works perfectly fine in a simple shell step.

- name: Get core count
  id: nproc
  run: echo "cores=$(nproc --all)" >> $GITHUB_OUTPUT
- name: Using nproc directly
  run: terraform plan -parallelism=$(nproc --all)

Why would I use your action instead? I don't see the benefit, but am curious for your use case. I mean this only works on Linux and macOS and a js based action would also run on Windows. On the other hand the js based action is like 3000 lines of code and a js engine needs to start up. ;)

idealo-ricardo-band avatar May 05 '23 15:05 idealo-ricardo-band

I do need it to work on Windows

SimenB avatar May 24 '23 08:05 SimenB

Wanna send a PR to the readme stating that this module isn't needed for systems with a functioning nproc?

SimenB avatar Sep 07 '23 12:09 SimenB