From 43812b9a24867a957a2ec2d1ad13d35dc4bf1892 Mon Sep 17 00:00:00 2001 From: Dave Cameron Date: Sun, 12 Aug 2018 09:37:37 -0400 Subject: [PATCH] Faster builds by limiting visible CPUs As described in this elm compiler issue: https://github.com/elm/compiler/issues/1473 --- .travis.yml | 11 ++++++++++- install_sysconfcpus | 13 +++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 install_sysconfcpus diff --git a/.travis.yml b/.travis.yml index 093c78b..ed30fa3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,11 +10,17 @@ addons: env: - TRAVIS_NODE_VERSION="v7.2.1" +cache: + directories: + - sysconfcpus + - protoc + before_install: - rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION + - ./install_sysconfcpus + - ./install_protobuf install: - - ./install_protobuf - export PATH=$PATH:$PWD/protoc/bin - go get -t -v ./protoc-gen-elm - protoc --version @@ -22,5 +28,8 @@ install: - npm --version - npm install -g elm - npm install -g elm-test + - mv $(npm config get prefix)/bin/elm-make $(npm config get prefix)/bin/elm-make-old + - printf '%s\n\n' '#!/bin/bash' 'echo "Running elm-make with sysconfcpus -n 2"' '$TRAVIS_BUILD_DIR/sysconfcpus/bin/sysconfcpus -n 2 elm-make-old "$@"' > $(npm config get prefix)/bin/elm-make + - chmod +x $(npm config get prefix)/bin/elm-make script: ./run_tests diff --git a/install_sysconfcpus b/install_sysconfcpus new file mode 100755 index 0000000..efc0a2a --- /dev/null +++ b/install_sysconfcpus @@ -0,0 +1,13 @@ +#!/bin/bash + +set -ex + +echo "Install libsysconfcpus to compensate for slow elm builds" +# More at: https://github.com/elm/compiler/issues/1473 +if [ ! -d sysconfcpus/bin ]; then + git clone https://github.com/obmarg/libsysconfcpus.git + cd libsysconfcpus + ./configure --prefix=$TRAVIS_BUILD_DIR/sysconfcpus + make && make install + cd .. +fi