From 3d81f519194f0516438b661f5e2a5aea54dd26f8 Mon Sep 17 00:00:00 2001
From: David Bauer <mail@david-bauer.net>
Date: Wed, 8 Nov 2023 00:37:21 +0100
Subject: [PATCH] ci: dynamically set thread-count

Despite what GitHub states in their documentation, the runners feature a
different core count. Automatically set the build thread-count by the
amount of available CPU cores.

Link: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources

Signed-off-by: David Bauer <mail@david-bauer.net>
---
 contrib/actions/run-build.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/contrib/actions/run-build.sh b/contrib/actions/run-build.sh
index cdff1e504..942f92106 100755
--- a/contrib/actions/run-build.sh
+++ b/contrib/actions/run-build.sh
@@ -9,5 +9,9 @@ export GLUON_SITEDIR="contrib/ci/minimal-site"
 export GLUON_TARGET="$1"
 export BUILD_LOG=1
 
+BUILD_THREADS="$(($(nproc) + 1))"
+
+echo "Building Gluon with $BUILD_THREADS threads"
+
 make update
-make -j2 V=s
+make -j$BUILD_THREADS V=s
-- 
GitLab