[PATCH 4/4] gitlab-ci: Add ccache in $PATH and display statistics

Philippe Mathieu-Daudé posted 4 patches 3 years, 4 months ago
There is a newer version of this series
[PATCH 4/4] gitlab-ci: Add ccache in $PATH and display statistics
Posted by Philippe Mathieu-Daudé 3 years, 4 months ago
If a runner has ccache installed, use it and display statistics
at the end of the build.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 .gitlab-ci.yml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a33e51bf453..d9a0252c54d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -21,13 +21,18 @@ include:
       then
         MAKE=gmake
         JOBS=$(sysctl -n hw.ncpu)
+        PATH=/usr/local/libexec/ccache:$PATH
         ;
       else
         MAKE=make
         JOBS=$(expr $(nproc) + 1)
+        PATH=/usr/lib/ccache:/usr/lib64/ccache:$PATH
         ;
       fi
     - echo "=== Using $JOBS simultaneous jobs ==="
+    - if command -v ccache > /dev/null ; then ccache --zero-stats ; fi
+  after_script:
+    - if command -v ccache > /dev/null ; then ccache --show-stats ; fi
 
 .native_build_job_template:
   stage: build
-- 
2.26.3