[llvm] [Github][CI] Add separate container for code-format premerge job (PR #161083)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 4 12:24:56 PDT 2025
================
@@ -0,0 +1,72 @@
+FROM docker.io/library/ubuntu:24.04 AS llvm-downloader
+
+ENV LLVM_VERSION=21.1.1
+
+RUN apt-get update && \
+ apt-get install -y wget xz-utils && \
+ wget --progress=bar:force -O llvm.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/LLVM-${LLVM_VERSION}-Linux-X64.tar.xz && \
+ mkdir -p /llvm-extract && \
+ tar -xvJf llvm.tar.xz -C /llvm-extract LLVM-${LLVM_VERSION}-Linux-X64/bin/ && \
+ rm llvm.tar.xz
+
+
+FROM docker.io/library/ubuntu:24.04 AS base
+
+ENV LLVM_SYSROOT=/opt/llvm
+ENV LLVM_VERSION=21.1.1
+
+# Need nodejs for some of the GitHub actions.
+# Need git for git-clang-format.
+RUN apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get install -y \
+ git \
+ nodejs \
+ sudo \
+ # These are needed by the premerge pipeline.
+ # Pip and venv are used to install dependent python packages.
+ python3-pip \
+ python3-venv \
+ python-is-python3 && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/*
+
+
+# Create a new user to avoid test failures related to a lack of expected
+# permissions issues in some tests. Set the user id to 1001 as that is the
+# user id that Github Actions uses to perform the checkout action.
+RUN useradd gha -u 1001 -m -s /bin/bash
+
+# Also add the user to passwordless sudoers so that we can install software
+# later on without having to rebuild the container.
+RUN adduser gha sudo
+RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
+
+USER gha
+WORKDIR /home/gha
+
+
+FROM base AS ci-container-code-format
+
+COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-format ${LLVM_SYSROOT}/bin/clang-format
+
+ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
+
+# Install dependencies for 'pr-code-format.yml' job
+COPY llvm/utils/git/requirements_formatting.txt /home/gha/requirements_formatting.txt
+RUN python -m venv venv && \
----------------
boomanaiden154 wrote:
I think we can drop the venvs and just do `--break-system-packages`. We aren't using any disto managed packages.
https://github.com/llvm/llvm-project/pull/161083
More information about the llvm-commits
mailing list