From 49cd30eea1ce4d5094a84f7dea4dec7f80d0d1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 24 Jun 2026 13:46:55 +0100 Subject: [PATCH] gitlab: pull ccache setup into .base_meson_ccache_job_template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This provides a consistent ccache setup across all build jobs. Signed-off-by: Daniel P. Berrangé Reviewed-by: Pierrick Bouvier Link: https://lore.kernel.org/qemu-devel/20260624124657.2725376-5-berrange@redhat.com Signed-off-by: Pierrick Bouvier --- .gitlab-ci.d/base.yml | 16 +++++++++++++ .gitlab-ci.d/buildtest-template.yml | 14 ++--------- .gitlab-ci.d/crossbuild-template.yml | 35 +++++----------------------- 3 files changed, 24 insertions(+), 41 deletions(-) diff --git a/.gitlab-ci.d/base.yml b/.gitlab-ci.d/base.yml index 94107579fe..366e654bcb 100644 --- a/.gitlab-ci.d/base.yml +++ b/.gitlab-ci.d/base.yml @@ -148,3 +148,19 @@ variables: - build/meson-logs reports: junit: build/meson-logs/*.junit.xml + +.base_meson_ccache_job_template: + extends: .base_meson_job_template + cache: + paths: + - ccache + key: "$CI_JOB_NAME" + when: always + script: + - export CCACHE_BASEDIR="$(pwd)" + - export CCACHE_DIR="$CCACHE_BASEDIR/ccache" + - export CCACHE_MAXSIZE="500M" + - export PATH="$CCACHE_WRAPPERSDIR:$PATH" + - ccache --zero-stats + after_script: + - ccache --show-stats diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.yml index 0fa2351d87..8dfd17a0b5 100644 --- a/.gitlab-ci.d/buildtest-template.yml +++ b/.gitlab-ci.d/buildtest-template.yml @@ -1,13 +1,8 @@ .native_build_job_template: - extends: .base_meson_job_template + extends: .base_meson_ccache_job_template stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG - cache: - paths: - - ccache - key: "$CI_JOB_NAME" - when: always before_script: - source scripts/ci/gitlab-ci-section - section_start setup "Pre-script setup" @@ -15,14 +10,10 @@ - cat /packages.txt - section_end setup script: - - export CCACHE_BASEDIR="$(pwd)" - - export CCACHE_DIR="$CCACHE_BASEDIR/ccache" - - export CCACHE_MAXSIZE="500M" - - export PATH="$CCACHE_WRAPPERSDIR:$PATH" + - !reference [.base_meson_ccache_job_template, script] - du -sh .git - mkdir build - cd build - - ccache --zero-stats - section_start configure "Running configure" - ../configure --enable-werror --disable-docs --enable-fdt=system --disable-debug-info @@ -43,7 +34,6 @@ $MAKE -j"$JOBS" $MAKE_CHECK_ARGS ; fi - section_end test - - ccache --show-stats # We jump some hoops in common_test_job_template to avoid # rebuilding all the object files we skip in the artifacts diff --git a/.gitlab-ci.d/crossbuild-template.yml b/.gitlab-ci.d/crossbuild-template.yml index 36bb9a405c..aadae26844 100644 --- a/.gitlab-ci.d/crossbuild-template.yml +++ b/.gitlab-ci.d/crossbuild-template.yml @@ -1,12 +1,7 @@ .cross_system_build_job: - extends: .base_meson_job_template + extends: .base_meson_ccache_job_template stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG - cache: - paths: - - ccache - key: "$CI_JOB_NAME" - when: always timeout: 80m before_script: - source scripts/ci/gitlab-ci-section @@ -15,13 +10,9 @@ - cat /packages.txt - section_end setup script: - - export CCACHE_BASEDIR="$(pwd)" - - export CCACHE_DIR="$CCACHE_BASEDIR/ccache" - - export CCACHE_MAXSIZE="500M" - - export PATH="$CCACHE_WRAPPERSDIR:$PATH" + - !reference [.base_meson_ccache_job_template, script] - mkdir build - cd build - - ccache --zero-stats - section_start configure "Running configure" - ../configure --enable-werror --disable-docs --enable-fdt=system --disable-user $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS @@ -46,7 +37,6 @@ mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi - section_end installer - - ccache --show-stats # Job to cross-build specific accelerators. # @@ -54,22 +44,15 @@ # KVM), and set extra options (such disabling other accelerators) via the # $EXTRA_CONFIGURE_OPTS variable. .cross_accel_build_job: - extends: .base_meson_job_template + extends: .base_meson_ccache_job_template stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG timeout: 60m - cache: - paths: - - ccache/ - key: "$CI_JOB_NAME" before_script: - source scripts/ci/gitlab-ci-section - JOBS=$(expr $(nproc) + 1) script: - - export CCACHE_BASEDIR="$(pwd)" - - export CCACHE_DIR="$CCACHE_BASEDIR/ccache" - - export CCACHE_MAXSIZE="500M" - - export PATH="$CCACHE_WRAPPERSDIR:$PATH" + - !reference [.base_meson_ccache_job_template, script] - mkdir build - cd build - section_start configure "Running configure" @@ -87,20 +70,14 @@ - section_end test .cross_user_build_job: - extends: .base_meson_job_template + extends: .base_meson_ccache_job_template stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG - cache: - paths: - - ccache/ - key: "$CI_JOB_NAME" before_script: - source scripts/ci/gitlab-ci-section - JOBS=$(expr $(nproc) + 1) script: - - export CCACHE_BASEDIR="$(pwd)" - - export CCACHE_DIR="$CCACHE_BASEDIR/ccache" - - export CCACHE_MAXSIZE="500M" + - !reference [.base_meson_ccache_job_template, script] - mkdir build - cd build - section_start configure "Running configure"