Extract CPU count script; add tests
This MR:
- Splits the CPU count into its own function
- Adds unit tests for the CPU count function
- Adds the CPU count routine to the main setup function
- Removes the
detect-cpu
YAML partial from the pipeline
Requires !323 (merged) to merge first.