Caching user cache on Travis


(David Střelák) #1

Is it possible to cache ‘User cache’ on Travis (using it’s caching mechanism), and thus speeding up the analysis?

I added ‘/home/travis/.sonar/cache’ into the .travis.yml file

cache:
  directories:
    - /home/travis/.sonar/cache

but I did not get any speedup.


(Fabrice Bellingard) #2

AFAIK, this works well. If you look at our sample projects, you will see that we use the cache. For instance, on this Travis YML file:

cache:
  directories:
    - '$HOME/.m2/repository'
    - '$HOME/.sonar/cache'

(David Střelák) #3

Hi Fabrice,
thanks for your response. I tried it again and unfortunately I don’t see any improvement.
From what I got from the log, the cache is created here: https://travis-ci.com/I2PC/xmipp/builds/104105083 and properly loaded here: https://travis-ci.com/I2PC/xmipp/jobs/184245806. However, the build time is pretty much the same. I removed one file which is not used anywhere, so the compilation should not be affected.

Do you know how the SonarCloud decides if the file has to be analyzed again?
I suspect wrong settings of the ccache (which had a lot of miss, but I am not sure why), and scons that we use, but I have no idea how to debug this.

I would be grateful for any hint.


(Scott) #4

Hi.

The .sonar/cache folder contains only the .jar files corresponding to the plugins available in the SonarQube server. This means that, in the best case scenario, caching this folder will make the download of plugins a bit faster. It’s almost useless, as you can see.

There isn’t a way to speed up the analysis using caching. The SonarQube Scanner always scans all the files, there’s no option to scan only the changed files.


SonarCloud on Travis speed-up tips
(David Střelák) #5

Hello Scott,

thanks for your answer. I have indeed seen that Travis cached a few jar files, but I was hoping that the temp files were simply omitted from the log.

I consider this topic closed. I will create a new one, where I will explicitly ask how to speed up the analysis.