From 259d8b2feed9da5ec75de1ab3c29139ea677d184 Mon Sep 17 00:00:00 2001 From: Shahar Soel Date: Wed, 27 Jul 2016 23:01:13 +0300 Subject: [PATCH] CI Build Fixes. In Short: * Enable Travis Cache to mitigate phantomjs download issues. * Enable Travis & appveyor functionality to avoid race condition on CI builds and old node.js version (0.10/0.12) Details: Using to download phantom (on travis) instead of because Travis downloads from http://cnpmjs.org/downloads are horribly slow (30k/s) and seem courrpt most of the time (smells like throttling) Travis caching is by branch + build env (node version). But it has a fallback to using the cache from the default branch so it should help even with pull requests (which are new branches). Secondly using and for to workaround race condition on with npm install and older versions of node. mitigates #2898 --- .travis.yml | 21 ++++++++++++++++++++- appveyor.yml | 10 ++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 238fb88d..a5d8e9bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,31 @@ language: node_js +cache: + directories: + - travis-phantomjs node_js: - "6" - "4" - "0.12" - "0.10" +before_install: + # from https://github.com/travis-ci/travis-ci/issues/3225#issuecomment-177592725 + # and also from https://github.com/travis-ci/travis-ci/issues/3225#issuecomment-200965782 + - phantomjs --version + - export PATH=$PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH + - phantomjs --version + # Clear cache and download new copy of PhantomJS if the current version doesn't match 2.1.1. + - "if [ $(phantomjs --version) != '2.1.1' ]; then rm -rf $PWD/travis-phantomjs; mkdir -p $PWD/travis-phantomjs; fi" + - "if [ $(phantomjs --version) != '2.1.1' ]; then wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2; fi" + - "if [ $(phantomjs --version) != '2.1.1' ]; then tar -xvf $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis-phantomjs; fi" + - phantomjs --version install: - npm install -g grunt-cli - - npm install + # node 0.10 & 0.12 have race condition issues when running custom install scripts + # this can cause phantomjs-prebuilt install script to fail with the error: + # + # Seems related to: https://github.com/npm/npm/issues/8152 + # using solves this. + - travis_retry npm install env: global: - PHANTOMJS_CDNURL=http://cnpmjs.org/downloads diff --git a/appveyor.yml b/appveyor.yml index 5739f95c..372a479d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,8 +14,14 @@ install: - npm -g install npm@2 - set PATH=%APPDATA%\npm;%PATH% - npm -v - # Typical npm stuff. - - npm install + + # node 0.10 & 0.12 have race condition issues when running custom install scripts + # this can cause phantomjs-prebuilt install script to fail with the error: + # + # Seems related to: https://github.com/npm/npm/issues/8152 + # using solves this. + - appveyor-retry call npm install + # Grunt-specific stuff. - npm install -g grunt-cli