浏览代码

Travis improvements

* get rid of duplicate call of apt-get update
* don't recompile neko
frabbit 8 年之前
父节点
当前提交
2072a9be1b
共有 1 个文件被更改,包括 18 次插入14 次删除
  1. 18 14
      .travis.yml

+ 18 - 14
.travis.yml

@@ -51,10 +51,7 @@ install_linux: &install_linux
     else
       export CACHE_AVAILABLE=1;
     fi
-  - export APT_CACHE_DIR=~/apt-cache && mkdir -pv $APT_CACHE_DIR
   # Install dependencies
-  - sudo add-apt-repository ppa:haxe/ocaml -y
-  - sudo apt-get update
   - sudo apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y
       ocaml
       ocaml-native-compilers
@@ -78,15 +75,17 @@ install_linux: &install_linux
       if [ ! -d "$HOME/neko/.git" ]; then
         git clone https://github.com/HaxeFoundation/neko.git .;
       else
+        export OLD_REF=`git rev-parse HEAD`;
         git fetch --all; git reset --hard origin/master;
       fi;
       git submodule update --init --recursive;
     fi
-  - cmake . -DSTATIC_DEPS=all -G Ninja || (git clean -dfx && export CACHE_AVAILABLE=0 && cmake . -DSTATIC_DEPS=all -G Ninja)
+  - export NEW_REF=`git rev-parse HEAD`
+  - test $OLD_REF = $NEW_REF || cmake . -DSTATIC_DEPS=all -G Ninja || (git clean -dfx && export CACHE_AVAILABLE=0 && cmake . -DSTATIC_DEPS=all -G Ninja)
   # download static dependencies before actual build, with 3 chances to deal with network issues
-  - ninja download_static_deps || ninja download_static_deps || ninja download_static_deps
-  - ninja -j 4
-  - sudo ninja install
+  - test $OLD_REF = $NEW_REF || ninja download_static_deps || ninja download_static_deps || ninja download_static_deps
+  - test $OLD_REF = $NEW_REF || (ninja -j 4)
+  - sudo cmake -P cmake_install.cmake
   - popd
   # Setup database
   - travis_retry sudo apt-get install mysql-server-5.6 -y
@@ -123,8 +122,8 @@ install_osx: &install_osx
       export CACHE_AVAILABLE=1;
     fi
   # Install dependencies
-  - brew uninstall --force brew-cask # https://github.com/caskroom/homebrew-cask/pull/15381
   - travis_retry brew update --merge
+  - brew uninstall --force brew-cask # https://github.com/caskroom/homebrew-cask/pull/15381
   - travis_retry brew install opam ninja zlib pcre mysql awscli;
   - brew outdated cmake || brew upgrade cmake # we need a recent cmake to use CMAKE_OSX_DEPLOYMENT_TARGET
   - export OPAMYES=1
@@ -142,15 +141,17 @@ install_osx: &install_osx
       if [ ! -d "$HOME/neko/.git" ]; then
         git clone https://github.com/HaxeFoundation/neko.git .;
       else
+        export OLD_REF=`git rev-parse HEAD`;
         git fetch --all; git reset --hard origin/master;
       fi;
       git submodule update --init --recursive;
     fi
-  - cmake . -DSTATIC_DEPS=all -G Ninja || (git clean -dfx && export CACHE_AVAILABLE=0 && cmake . -DSTATIC_DEPS=all -G Ninja)
+  - export NEW_REF=`git rev-parse HEAD`
+  - test $OLD_REF = $NEW_REF || cmake . -DSTATIC_DEPS=all -G Ninja || (git clean -dfx && export CACHE_AVAILABLE=0 && cmake . -DSTATIC_DEPS=all -G Ninja)
   # download static dependencies before actual build, with 3 chances to deal with network issues
-  - ninja download_static_deps || ninja download_static_deps || ninja download_static_deps
-  - ninja -j 4
-  - sudo ninja install
+  - test $OLD_REF = $NEW_REF || ninja download_static_deps || ninja download_static_deps || ninja download_static_deps
+  - test $OLD_REF = $NEW_REF || (ninja -j 4)
+  - sudo cmake -P cmake_install.cmake
   - popd
   # Setup database
   - mysql.server start
@@ -194,7 +195,9 @@ matrix:
       #   <<: *addons
       #  sauce_connect: true
       before_install:
-        - sudo apt-get update -y || true
+        - export APT_CACHE_DIR=~/apt-cache && mkdir -pv $APT_CACHE_DIR
+        - sudo add-apt-repository ppa:haxe/ocaml -y
+        - sudo apt-get update -y
         - "export DISPLAY=:99.0"
         - "sh -e /etc/init.d/xvfb start"
         - "export AUDIODEV=null"
@@ -206,7 +209,8 @@ matrix:
         - HXCPP_COMPILE_CACHE=~/hxcache
       before_install:
         - export APT_CACHE_DIR=~/apt-cache && mkdir -pv $APT_CACHE_DIR
-        - sudo apt-get update -y || true
+        - sudo add-apt-repository ppa:haxe/ocaml -y
+        - sudo apt-get update -y
         - travis_retry sudo apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y
             gcc-multilib
             g++-multilib