ci: stop hard coding number of jobs for make
authorVincent Fu <vincent.fu@samsung.com>
Thu, 18 Jan 2024 17:20:29 +0000 (12:20 -0500)
committerVincent Fu <vincent.fu@samsung.com>
Thu, 18 Jan 2024 18:00:31 +0000 (13:00 -0500)
GitHub increased the number of CPUs in its GitHub-hosted runners from
two to four for Linux and Windows. macOS remains at two CPUs. Stop
hard-coding the number of CPUs when we build fio and detect the number
at runtime.

https://github.blog/2024-01-17-github-hosted-runners-double-the-power-for-open-source/

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
ci/actions-build.sh

index 31d3446c076016530e80b95ef96bd8af79eece5b..47d4f044ecc49b7cd3efa6ae061c8a06cb9260c0 100755 (executable)
@@ -61,7 +61,9 @@ main() {
     configure_flags+=(--extra-cflags="${extra_cflags}")
 
     ./configure "${configure_flags[@]}"
-    make -j 2
+    make -j "$(nproc 2>/dev/null || sysctl -n hw.logicalcpu)"
+# macOS does not have nproc, so we have to use sysctl to obtain the number of
+# logical CPUs.
 }
 
 main