diff mbox series

[v2,24/25] gitlab: add avocado asset caching

Message ID 20200624140446.15380-25-alex.bennee@linaro.org
State Superseded
Headers show
Series testing/next (vm, gitlab, docker) | expand

Commit Message

Alex Bennée June 24, 2020, 2:04 p.m. UTC
These can be quite big so lets cache them. I couldn't find any nots on
ccache in the gitlab docs so I've just ignored it for now.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Message-Id: <20200622143204.12921-19-alex.bennee@linaro.org>
---
 .gitlab-ci.yml | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
2.20.1

Comments

Daniel P. Berrangé June 24, 2020, 2:56 p.m. UTC | #1
On Wed, Jun 24, 2020 at 03:04:45PM +0100, Alex Bennée wrote:
> These can be quite big so lets cache them. I couldn't find any nots on

> ccache in the gitlab docs so I've just ignored it for now.


There's no built-in support for ccache, but you can enable it
reasonably easily.

In libvirt we add "ccache" to the dockerfile as a package to
be installed in the container image.

Then in the dockerfile again we add

  mkdir -p /usr/libexec/ccache-wrappers
  ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc
  ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/$(basename /usr/bin/gcc)
  export CCACHE_WRAPPERSDIR=/usr/libexec/ccache-wrappers

And in .gitlab-ci.yml, in each job we set

  before_script:
    export CCACHE_BASEDIR="$(pwd)
    export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
    export CCACHE_MAXSIZE="500M"
    export PATH="$CCACHE_WRAPPERSDIR:$PATH"
  cache:
    paths:
      - ccache/
    key: "$CI_JOB_NAME"

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
diff mbox series

Patch

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 54da29dd384..683a1d90fe6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,6 +8,12 @@  stages:
   - build
   - test
 
+# We assume GitLab has it's own caching set up for RPM/APT repositories so we
+# just take care of avocado assets here.
+cache:
+  paths:
+    - $HOME/avocado/data/cache
+
 include:
   - local: '/.gitlab-ci.d/edk2.yml'
   - local: '/.gitlab-ci.d/opensbi.yml'