I have enabled ccache
in my Github workflow. Surprisingly and differently from what happens when I build the library on my local machine where I get a hit rate of 100%, during Github build I am getting a hit rate of 30%. Therefore I wanted to enable the CCACHE_LOGFILE
functionality in order to investigate the reason for this low hit rate. Please note that I have ccache
enabled for Linux, Macos and Windows builds. Let's take as example only the Linux build. The same issue is happening for all the other builds.
In my Github workflow file I have the following action to set ccache
environment variables:
- name: CCache Configure
if: matrix.settings.os != 'windows-latest'
id: ccache-config-linux
shell: bash
run: |
source build/generators/conanbuild.sh
mkdir $HOME/.ccache
export CCACHE_DIR=$HOME/.ccache
export CCACHE_SLOPPINESS=pch_defines,time_macros
export CCACHE_NOHASHDIR=1
export CCACHE_LOGFILE=$HOME/.ccache/CcacheLogFile.log
#export CCACHE_RECACHE=1
echo "CCACHE_HOME=$HOME/.ccache" >> $GITHUB_ENV
ccache -p
And then the following action to show the results of the ccache
build process and to show the content of the log file:
- name: CCache Stats
if: matrix.settings.os != 'windows-latest'
shell: bash
run: |
source build/generators/conanbuild.sh
ccache -d $HOME/.ccache -svvz
ls -la $HOME/.ccache
cat $HOME/.ccache/CcacheLogFile.log
rm $HOME/.ccache/CcacheLogFile.log
ls -la $HOME/.ccache
Surprise surprise... The file CcacheLogFile.log
is empty! As it can be seen from the command output cat $HOME/.ccache/CcacheLogFile.log
total 76
drwxr-xr-x 19 runner docker 4096 Nov 3 22:55 .
drwxr-x--- 17 runner docker 4096 Nov 4 08:47 ..
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 0
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 1
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 2
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 3
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 4
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 5
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 6
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 7
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 8
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 9
-rw-r--r-- 1 runner docker 0 Nov 3 23:53 CcacheLogFile.log
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 a
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 b
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 c
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 d
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 e
drwxr-xr-x 18 runner docker 4096 Nov 4 08:51 f
drwxr-xr-x 2 runner docker 4096 Nov 4 08:50 lock
So... Not sure what's going wrong here. When I enable the CCACHE_LOGFILE
in my local machine build everything goes smoothly.
Has anyone faced the same issue before?
Any advice is highly appreciated. Thank you in advance for your time.