ci(fedora41): split install prerequisites and build IWYU into separate phases

It improves parallelization and speeds up the build by reusing cached layers.
This commit is contained in:
Alex Turbov 2025-01-29 18:42:25 +04:00 committed by Brad King
parent 4b0ac15b49
commit dc9b7a15c0
2 changed files with 11 additions and 7 deletions

View File

@ -37,16 +37,23 @@ RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \
sh /root/install_rvm.sh
FROM ${BASE_IMAGE} AS iwyu-build
FROM ${BASE_IMAGE} AS iwyu-build-env
LABEL maintainer="Kyle Edwards <kyle.edwards@kitware.com>"
# Pre-install prerequisites to build IWYU.
RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \
--mount=type=bind,source=install_iwyu.sh,target=/root/install_iwyu.sh \
--mount=type=bind,source=iwyu_packages.lst,target=/root/iwyu_packages.lst \
--mount=type=cache,from=dnf-cache,source=/var/cache/libdnf5,target=/var/cache/libdnf5,sharing=private \
--mount=type=tmpfs,target=/var/log \
--mount=type=tmpfs,target=/tmp \
sh /root/install_iwyu.sh
dnf install -y $(grep '^[^#]\+$' /root/iwyu_packages.lst)
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=tmpfs,target=/tmp \
sh /root/build_iwyu.sh
FROM ${BASE_IMAGE} AS p4-dl

View File

@ -2,9 +2,6 @@
set -e
# Install development tools.
dnf install -y $(grep '^[^#]\+$' /root/iwyu_packages.lst)
cd /root
git clone "https://github.com/include-what-you-use/include-what-you-use.git"
cd include-what-you-use