@samitouri / QOSamiQemu / commits / 49cd30eea1

gitlab: pull ccache setup into .base_meson_ccache_job_template

This provides a consistent ccache setup across all build jobs. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Link: https://lore.kernel.org/qemu-devel/20260624124657.2725376-5-berrange@redhat.com Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>

Daniel P. Berrangé committed Jun 24, 2026 at 13:46 UTC 49cd30eea1ce4d5094a84f7dea4dec7f80d0d1e5
3 files changed +24 -41
.gitlab-ci.d/base.yml
+16
@@ -148,3 +148,19 @@ variables:
148 - build/meson-logs
149 reports:
150 junit: build/meson-logs/*.junit.xml
151 +
152 +.base_meson_ccache_job_template:
153 + extends: .base_meson_job_template
154 + cache:
155 + paths:
156 + - ccache
157 + key: "$CI_JOB_NAME"
158 + when: always
159 + script:
160 + - export CCACHE_BASEDIR="$(pwd)"
161 + - export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
162 + - export CCACHE_MAXSIZE="500M"
163 + - export PATH="$CCACHE_WRAPPERSDIR:$PATH"
164 + - ccache --zero-stats
165 + after_script:
166 + - ccache --show-stats
.gitlab-ci.d/buildtest-template.yml
+2 -12
@@ -1,13 +1,8 @@
1
2 .native_build_job_template:
3 - extends: .base_meson_job_template
3 + extends: .base_meson_ccache_job_template
4 stage: build
5 image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
6 - cache:
7 - paths:
8 - - ccache
9 - key: "$CI_JOB_NAME"
10 - when: always
6 before_script:
7 - source scripts/ci/gitlab-ci-section
8 - section_start setup "Pre-script setup"
@@ -15,14 +10,10 @@
10 - cat /packages.txt
11 - section_end setup
12 script:
18 - - export CCACHE_BASEDIR="$(pwd)"
19 - - export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
20 - - export CCACHE_MAXSIZE="500M"
21 - - export PATH="$CCACHE_WRAPPERSDIR:$PATH"
13 + - !reference [.base_meson_ccache_job_template, script]
14 - du -sh .git
15 - mkdir build
16 - cd build
25 - - ccache --zero-stats
17 - section_start configure "Running configure"
18 - ../configure --enable-werror --disable-docs --enable-fdt=system
19 --disable-debug-info
@@ -43,7 +34,6 @@
34 $MAKE -j"$JOBS" $MAKE_CHECK_ARGS ;
35 fi
36 - section_end test
46 - - ccache --show-stats
37
38 # We jump some hoops in common_test_job_template to avoid
39 # rebuilding all the object files we skip in the artifacts
.gitlab-ci.d/crossbuild-template.yml
+6 -29
@@ -1,12 +1,7 @@
1 .cross_system_build_job:
2 - extends: .base_meson_job_template
2 + extends: .base_meson_ccache_job_template
3 stage: build
4 image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
5 - cache:
6 - paths:
7 - - ccache
8 - key: "$CI_JOB_NAME"
9 - when: always
5 timeout: 80m
6 before_script:
7 - source scripts/ci/gitlab-ci-section
@@ -15,13 +10,9 @@
10 - cat /packages.txt
11 - section_end setup
12 script:
18 - - export CCACHE_BASEDIR="$(pwd)"
19 - - export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
20 - - export CCACHE_MAXSIZE="500M"
21 - - export PATH="$CCACHE_WRAPPERSDIR:$PATH"
13 + - !reference [.base_meson_ccache_job_template, script]
14 - mkdir build
15 - cd build
24 - - ccache --zero-stats
16 - section_start configure "Running configure"
17 - ../configure --enable-werror --disable-docs --enable-fdt=system
18 --disable-user $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS
@@ -46,7 +37,6 @@
37 mv -v qemu-setup*.exe qemu-setup-${version}.exe;
38 fi
39 - section_end installer
49 - - ccache --show-stats
40
41 # Job to cross-build specific accelerators.
42 #
@@ -54,22 +44,15 @@
44 # KVM), and set extra options (such disabling other accelerators) via the
45 # $EXTRA_CONFIGURE_OPTS variable.
46 .cross_accel_build_job:
57 - extends: .base_meson_job_template
47 + extends: .base_meson_ccache_job_template
48 stage: build
49 image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
50 timeout: 60m
61 - cache:
62 - paths:
63 - - ccache/
64 - key: "$CI_JOB_NAME"
51 before_script:
52 - source scripts/ci/gitlab-ci-section
53 - JOBS=$(expr $(nproc) + 1)
54 script:
69 - - export CCACHE_BASEDIR="$(pwd)"
70 - - export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
71 - - export CCACHE_MAXSIZE="500M"
72 - - export PATH="$CCACHE_WRAPPERSDIR:$PATH"
55 + - !reference [.base_meson_ccache_job_template, script]
56 - mkdir build
57 - cd build
58 - section_start configure "Running configure"
@@ -87,20 +70,14 @@
70 - section_end test
71
72 .cross_user_build_job:
90 - extends: .base_meson_job_template
73 + extends: .base_meson_ccache_job_template
74 stage: build
75 image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
93 - cache:
94 - paths:
95 - - ccache/
96 - key: "$CI_JOB_NAME"
76 before_script:
77 - source scripts/ci/gitlab-ci-section
78 - JOBS=$(expr $(nproc) + 1)
79 script:
101 - - export CCACHE_BASEDIR="$(pwd)"
102 - - export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
103 - - export CCACHE_MAXSIZE="500M"
80 + - !reference [.base_meson_ccache_job_template, script]
81 - mkdir build
82 - cd build
83 - section_start configure "Running configure"