[llvm] [github] pre-cache llvm-project in Linux CI Docker images (PR #133137)

George Burgess IV via llvm-commits llvm-commits at lists.llvm.org
Fri May 2 08:29:11 PDT 2025


https://github.com/gburgessiv updated https://github.com/llvm/llvm-project/pull/133137

>From 141d5fb1abcfe698a7eb26f19c792e645fd7282b Mon Sep 17 00:00:00 2001
From: George Burgess IV <george.burgess.iv at gmail.com>
Date: Wed, 26 Mar 2025 11:32:22 -0600
Subject: [PATCH] [github] pre-cache llvm-project in Linux CI Docker images

Linux CI bots take a bit over a minute to fully set their git repos up,
always starting from scratch. This can end up being a significant
percentage of their overall runtime.

If llvm-project is built into the images & used as a cache, we could
potentially speed that up quite a bit. Try it out and see.
---
 .../workflows/containers/github-action-ci/Dockerfile  | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/.github/workflows/containers/github-action-ci/Dockerfile b/.github/workflows/containers/github-action-ci/Dockerfile
index 2e0c23dbd51e3..5beccf97b0f8e 100644
--- a/.github/workflows/containers/github-action-ci/Dockerfile
+++ b/.github/workflows/containers/github-action-ci/Dockerfile
@@ -94,3 +94,14 @@ RUN mkdir actions-runner && \
     tar xzf ./actions-runner-linux-x64-$GITHUB_RUNNER_VERSION.tar.gz && \
     rm ./actions-runner-linux-x64-$GITHUB_RUNNER_VERSION.tar.gz
 
+# Pre-cache llvm-project in these images; this works with the premerge action
+# to speed up runs; cloning LLVM fresh takes >1min otherwise.
+#
+# A local experiment showed an explicit `git gc --aggressive` reduced this
+# layer's size by ~800MB (4.1GB -> 3.3GB). Disable GC'ing
+# afterward, so we don't waste time trying to do that in CI.
+RUN \
+  git clone https://github.com/llvm/llvm-project --tags && \
+  cd llvm-project && \
+  git gc --aggressive && \
+  git config gc.auto 0



More information about the llvm-commits mailing list