From 59383f650977b73bf3764d173d19b20039f0454d Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Wed, 29 Jan 2025 18:52:54 +0400 Subject: ci(fedora41): use cache for IWYU build --- .gitlab/ci/docker/fedora41/Dockerfile | 7 ++++--- .gitlab/ci/docker/fedora41/build_iwyu.sh | 18 +++++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.gitlab/ci/docker/fedora41/Dockerfile b/.gitlab/ci/docker/fedora41/Dockerfile index 40fafc3..4ef87da 100644 --- a/.gitlab/ci/docker/fedora41/Dockerfile +++ b/.gitlab/ci/docker/fedora41/Dockerfile @@ -52,6 +52,7 @@ FROM iwyu-build-env AS iwyu-build LABEL maintainer="Kyle Edwards " # Build IWYU. RUN --mount=type=bind,source=build_iwyu.sh,target=/root/build_iwyu.sh \ + --mount=type=cache,target=/root/include-what-you-use \ --mount=type=tmpfs,target=/tmp \ sh /root/build_iwyu.sh @@ -78,11 +79,11 @@ RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \ --mount=type=tmpfs,target=/tmp \ sh /root/install_deps.sh +RUN --mount=type=bind,from=iwyu-build,source=/root,target=/root \ + tar -C / -xf /root/iwyu.tar + RUN --mount=type=bind,from=rust-build,source=/root,target=/root \ tar -C /usr/local -xf /root/rust.tar RUN --mount=type=bind,from=rvm-build,source=/root,target=/root \ tar -C /usr/local -xf /root/rvm.tar - -RUN --mount=type=bind,from=iwyu-build,source=/root,target=/root \ - tar -C / -xf /root/iwyu.tar diff --git a/.gitlab/ci/docker/fedora41/build_iwyu.sh b/.gitlab/ci/docker/fedora41/build_iwyu.sh index ae9d306..60d5cfd 100755 --- a/.gitlab/ci/docker/fedora41/build_iwyu.sh +++ b/.gitlab/ci/docker/fedora41/build_iwyu.sh @@ -2,16 +2,24 @@ set -e -cd /root -git clone "https://github.com/include-what-you-use/include-what-you-use.git" -cd include-what-you-use +cd +if [ -d include-what-you-use/.git ]; then + cd include-what-you-use + git pull +else + git clone https://github.com/include-what-you-use/include-what-you-use.git + cd include-what-you-use +fi + readonly llvm_full_version="$( clang --version | head -n1 | cut -d' ' -f3 )" readonly llvm_version="$( echo "$llvm_full_version" | cut -d. -f-1 )" git checkout "clang_$llvm_version" -mkdir build + +mkdir -p build cd build cmake -GNinja \ + --fresh \ -DCMAKE_BUILD_TYPE=Release \ -DIWYU_RESOURCE_RELATIVE_TO=clang \ -DIWYU_RESOURCE_DIR=../lib/clang/"$llvm_version" \ @@ -22,4 +30,4 @@ cmake --build . --parallel DESTDIR=~/iwyu-destdir cmake --install . -tar -C /root/iwyu-destdir -cf /root/iwyu.tar . +tar -C ~/iwyu-destdir -cf ~/iwyu.tar . -- cgit v0.12