ruby-changes:53515
From: shyouhei <ko1@a...>
Date: Thu, 15 Nov 2018 11:25:28 +0900 (JST)
Subject: [ruby-changes:53515] shyouhei:r65731 (trunk): .travis.yml: enable ccache
shyouhei 2018-11-15 11:25:25 +0900 (Thu, 15 Nov 2018) New Revision: 65731 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65731 Log: .travis.yml: enable ccache Travis has `cache: ccache` feature so let us enable it. Also, because `config.cache` is generated during the compilation why not cache that file for a later use. [fix GH-2013] Caveats: - When something went wrong, cache entries can be deleted from https://travis-ci.org/ruby/ruby/caches (requires login). - See `ccache(1)` manual page for the new environment variables. - `ccache` thinks two compilations are not identical if they produce different diagnostics. The -fno-diagnostics-color option is to prevent such cache missihts only because TTY is present / absent at the compilation time. - In this changeset two "ccache --show-stats" invocations are inserted before and after the compilation to measure cache hit rates etc. Will revisit their outputs once the cache is warmed up. Modified files: trunk/.travis.yml Index: .travis.yml =================================================================== --- .travis.yml (revision 65730) +++ .travis.yml (revision 65731) @@ -55,10 +55,19 @@ addons: https://github.com/ruby/ruby/blob/trunk/.travis.yml#L55 - libffi - openssl@1... - zlib + - ccache + +cache: + ccache: true + directories: + - "$HOME/config_2nd" env: global: - "CONFIGURE_TTY=no" + - "CCACHE_COMPILERCHECK=none" + - "CCACHE_NOCOMPRESS=1" + - "CCACHE_MAXSIZE=512Mi" .org.ruby-lang.ci.matrix-definitions: @@ -169,8 +178,8 @@ env: https://github.com/ruby/ruby/blob/trunk/.travis.yml#L178 name: i686-linux <<: *linux sudo: required - compiler: "'gcc-8 -m32'" env: + - "GCC_FLAGS=-m32" - "CONFIG_FLAG='debugflags=-g0'" - "SETARCH='setarch i686 --verbose --3gb'" addons: @@ -201,8 +210,9 @@ env: https://github.com/ruby/ruby/blob/trunk/.travis.yml#L210 name: "-ansi -pedantic" <<: *linux <<: *make-test-only - compiler: "'clang -ansi -Werror=pedantic -pedantic-errors -std=iso9899:1990'" + compiler: clang env: + - "GCC_FLAGS='-ansi -Werror=pedantic -pedantic-errors -std=iso9899:1990'" - "CONFIG_FLAG=" - "JOBS=" # construct warnflags (using bashism...) @@ -304,16 +314,34 @@ before_script: https://github.com/ruby/ruby/blob/trunk/.travis.yml#L314 - "make touch-unicode-files" - "make -s $JOBS srcs UNICODE_FILES=." - "rm config.status Makefile rbconfig.rb .rbconfig.time" - - "mkdir build config_1st config_2nd" + - |- + if [ -d ~/config_2nd ]; then + cp -pr ~/config_2nd build + else + mkdir build + fi + - "mkdir config_1st config_2nd" - "chmod -R a-w ." - - "chmod u+w build config_1st config_2nd" + - "chmod -R u+w build config_1st config_2nd" - "cd build" - - "$SETARCH ../configure -C --disable-install-doc --prefix=/tmp/ruby-prefix --with-gcc=\"$CC\" $CONFIG_FLAG \"${CONFIG_FLAG_ARRAY[@]}\"" + - "ccache --show-stats" + - |- + case "$CC" in + gcc*) the_gcc=(ccache $CC ${GCC_FLAGS[@]} -fno-diagnostics-color) ;; + clang*) the_gcc=(ccache $CC ${GCC_FLAGS[@]} -fno-color-diagnostics) ;; + esac + $SETARCH ../configure -C --disable-install-doc --prefix=/tmp/ruby-prefix --with-gcc="${the_gcc[*]}" $CONFIG_FLAG "${CONFIG_FLAG_ARRAY[@]}" - "cp -pr config.cache config.status .ext/include ../config_1st" - "$SETARCH make reconfig" - "cp -pr config.cache config.status .ext/include ../config_2nd" - "(cd .. && exec diff -ru config_1st config_2nd)" + - | + chmod u+w .. + rm -r ~/config_2nd + mv ../config_2nd ~ + chmod u-w .. - "$SETARCH make -s $JOBS && make install" + - "ccache --show-stats" script: - "$SETARCH make -s test TESTOPTS=\"${TESTOPTS=$JOBS -q --tty=no}\"" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/