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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shyouhei 2018-11-15 02:25:25 +00:00
Родитель ebdf9f0758
Коммит 7855c23ae8
1 изменённых файлов: 33 добавлений и 5 удалений

Просмотреть файл

@ -55,10 +55,19 @@ addons:
- libffi
- openssl@1.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:
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:
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:
- "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}\""