Skip to content

Commit

Permalink
automatically determine an appropriate number of jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
johan-boule committed Apr 8, 2019
1 parent ae55bc3 commit 8e07b6b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
32 changes: 28 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,37 @@
os:
- linux

language: minimal

branches.only:
- docker

services:
- docker

script:
# - docker build -t "$DOCKER_USERNAME"/cxx-modules-sandbox:latest .
- printf '%s' "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
# - docker push "$DOCKER_USERNAME"/cxx-modules-sandbox:latest
script: |
set -eux &&
tag=cxx-modules-sandbox:latest
log=$(mktemp) # log to a file because travis rejects having big logs
# also, emit a message periodically otherwise travis thinks the build stalled and kills it
(while :; do sleep 5m; tail -n10 $log; done) &
log_pid=$!
# build the image
if ! docker image build -t "$DOCKER_USERNAME"/$tag . &> $log
then
# on failure, print tail of log before bailing out
error=$!
kill $log_pid
tail -c100000 $log
return $error
fi
# stop monitoring the log
kill $log_pid
# publish the image
printf '%s' "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker image push "$DOCKER_USERNAME"/$tag
3 changes: 2 additions & 1 deletion install_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ readonly url="https://gitlab.kitware.com/ben.boeckel/cmake.git"
readonly workdir="$HOME/misc/code/cmake"
readonly srcdir="$workdir/cmake"
readonly builddir="$workdir/build"
readonly jobs=$(($(getconf _NPROCESSORS_ONLN) * 1))

git clone "$url" "$srcdir"
cd "$srcdir"
git checkout "$cmake_version"
mkdir -p "$builddir"
cd "$builddir"
"$srcdir/bootstrap" \
--parallel=14 \
--parallel=$jobs \
--prefix="$HOME/misc/root/cmake"
make -j14 install
rm -rf "$workdir"
5 changes: 3 additions & 2 deletions install_gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ readonly url="svn://gcc.gnu.org/svn/gcc/branches/c++-modules"
readonly workdir="$HOME/misc/code/gcc"
readonly srcdir="$workdir/gcc"
readonly builddir="$workdir/build"
readonly jobs=$(($(getconf _NPROCESSORS_ONLN) * 1))

svn checkout "-r$revision" "$url" "$srcdir"
cd "$srcdir"
Expand All @@ -18,6 +19,6 @@ cd "$builddir"
"$srcdir/configure" \
--disable-multilib \
--prefix="$HOME/misc/root/gcc"
make -j14
make -j14 install
make -j$jobs
make -j$jobs install
rm -rf "$workdir"

0 comments on commit 8e07b6b

Please sign in to comment.