ci(fedora41): use cache for IWYU build

This commit is contained in:
Alex Turbov 2025-01-29 18:52:54 +04:00 committed by Brad King
parent dc9b7a15c0
commit 59383f6509
2 changed files with 17 additions and 8 deletions

View File

@ -52,6 +52,7 @@ FROM iwyu-build-env AS iwyu-build
LABEL maintainer="Kyle Edwards <kyle.edwards@kitware.com>"
# 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

View File

@ -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 .