[libvirt PATCH v3 10/12] gitlab: introduce use of ccache for speeding up rebuilds

Daniel P. Berrangé berrange at redhat.com
Thu Mar 26 12:35:36 UTC 2020


For any given job there is a high liklihood that ccache will be able to
reuse previously built object files. This will result in faster build
pipelines in later updates.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 .gitlab-ci.yml | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 53600c3a96..d38672f260 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,6 +13,15 @@ stages:
 # Default native build jobs that are always run
 .native_build_default_job_template: &native_build_default_job_definition
   stage: native_build
+  cache:
+    paths:
+      - ccache/
+    key: "$CI_JOB_NAME"
+  before_script:
+    - mkdir -p ccache
+    - export CC="ccache gcc"
+    - export CCACHE_BASEDIR=${PWD}
+    - export CCACHE_DIR=${PWD}/ccache
   script:
     - mkdir build
     - cd build
@@ -31,6 +40,15 @@ stages:
 # Default cross build jobs that are always run
 .cross_build_default_job_template: &cross_build_default_job_definition
   stage: cross_build
+  cache:
+    paths:
+      - ccache/
+    key: "$CI_JOB_NAME"
+  before_script:
+    - mkdir -p ccache
+    - export CC="ccache ${ABI}-gcc"
+    - export CCACHE_BASEDIR=${PWD}
+    - export CCACHE_DIR=${PWD}/ccache
   script:
     - mkdir build
     - cd build
@@ -63,10 +81,14 @@ x64-debian-sid:
 x64-centos-7:
   <<: *native_build_default_job_definition
   image: quay.io/libvirt/buildenv-libvirt-centos-7:latest
+  # ccache isn't available
+  before_script:
 
 x64-centos-8:
   <<: *native_build_extra_job_definition
   image: quay.io/libvirt/buildenv-libvirt-centos-8:latest
+  # ccache isn't available
+  before_script:
 
 x64-fedora-30:
   <<: *native_build_default_job_definition
-- 
2.24.1




More information about the libvir-list mailing list