[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 4/5] gitlab-ci.yml: Compile with ccache enabled
From: |
Thomas Huth |
Subject: |
[RFC PATCH 4/5] gitlab-ci.yml: Compile with ccache enabled |
Date: |
Wed, 14 Apr 2021 10:19:06 +0200 |
Ccache can speed up the compilation in some cases, so enable it for
our CI builds, too.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
.gitlab-ci.yml | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 52d65d6c04..422608381e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -18,7 +18,26 @@ include:
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
before_script:
- JOBS=$(expr $(nproc) + 1)
+ cache:
+ key: "$CI_JOB_NAME"
+ paths:
+ - ccache
script:
+ - mkdir -p ccache
+ - if command -v ccache ; then
+ export CCACHE_BASEDIR=${PWD} ;
+ export CCACHE_DIR=${PWD}/ccache ;
+ export CCACHE_MAXSIZE="1G" ;
+ export CCACHE_COMPILERCHECK=content ;
+ if [ -e /usr/lib/ccache/bin ]; then
+ export PATH=/usr/lib/ccache/bin:$PATH ;
+ elif [ -e /usr/lib/ccache ]; then
+ export PATH=/usr/lib/ccache:$PATH ;
+ elif [ -e /usr/lib64/ccache ]; then
+ export PATH=/usr/lib64/ccache:$PATH ;
+ fi ;
+ ccache --zero-stats ;
+ fi
- mkdir build
- cd build
- if test -n "$TARGETS";
@@ -36,6 +55,7 @@ include:
then
make -j"$JOBS" $MAKE_CHECK_ARGS ;
fi
+ - if command -v ccache ; then ccache --show-stats ; fi
.native_test_job_template: &native_test_job_definition
stage: test
--
2.27.0
- [RFC PATCH 0/5] Use ccache in the gitlab-CI, Thomas Huth, 2021/04/14
- [RFC PATCH 1/5] tests/docker/dockerfiles: Add ccache to containers where it was missing, Thomas Huth, 2021/04/14
- [RFC PATCH 2/5] tests/docker/dockerfiles/ubuntu2004: Add missing symlink for cc, Thomas Huth, 2021/04/14
- [RFC PATCH 3/5] gitlab-ci.d/crossbuilds: Limit the amount of targets in the cross-win64 build, Thomas Huth, 2021/04/14
- [RFC PATCH 4/5] gitlab-ci.yml: Compile with ccache enabled,
Thomas Huth <=
- [RFC PATCH 5/5] gitlab-ci.d/crossbuilds.yml: Enable compilation with ccache, Thomas Huth, 2021/04/14
- Re: [RFC PATCH 0/5] Use ccache in the gitlab-CI, Stefan Hajnoczi, 2021/04/14