summaryrefslogtreecommitdiff
path: root/ci/build
diff options
context:
space:
mode:
authorAlexander Lanin <alex@lanin.de>2020-07-05 21:00:05 +0200
committerGitHub <noreply@github.com>2020-07-05 21:00:05 +0200
commitc91850268b46b049447eec024b94d4d3bb9e40d7 (patch)
tree38d00490ccf8eb3583af31ce7d0162a729bc75f4 /ci/build
parent3c302a778f5a6623f130e4962561dbe690c0a538 (diff)
downloadccache-c91850268b46b049447eec024b94d4d3bb9e40d7.tar.gz
Run compilation and tests with multiple threads (#610)
Diffstat (limited to 'ci/build')
-rwxr-xr-xci/build10
1 files changed, 7 insertions, 3 deletions
diff --git a/ci/build b/ci/build
index 9cc44297..5b79f277 100755
--- a/ci/build
+++ b/ci/build
@@ -11,11 +11,15 @@ fi
if [ -n "${SPECIAL:-}" ]; then
exec "ci/$SPECIAL"
else
+ [ -z ${JOBS+x} ] && JOBS=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
+ [ -z ${JOBS+x} ] && JOBS=2
+
mkdir -p ${BUILDDIR:-build}
cd ${BUILDDIR:-build}
- ${CMAKE_PREFIX:-} cmake "${CCACHE_LOC:-..}" ${CMAKE_PARAMS:-}
+ ${CMAKE_PREFIX:-} cmake ${CMAKE_PARAMS:-} ${CCACHE_LOC:-..}
# 4 jobs seem to be a reasonable default for Travis.
- ${CMAKE_PREFIX:-} cmake --build . ${BUILDEXTRAFLAGS:-} -- -j4
+ ${CMAKE_PREFIX:-} cmake --build . ${BUILDEXTRAFLAGS:-} -- -j${JOBS}
# Warning: Rare random failures when running with -j4.
- [ "${RUN_TESTS:-1}" -ne "1" ] || ctest --output-on-failure -j1
+ [ "${RUN_TESTS:-1}" -ne "1" ] || ctest --output-on-failure -j${JOBS}
fi
+exit 0