Skip to content

Commit 5c95234

Browse files
committed
[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.
1 parent 27d9a3a commit 5c95234

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,14 @@ RUN mkdir actions-runner && \
103103
tar xzf ./actions-runner-linux-x64-$GITHUB_RUNNER_VERSION.tar.gz && \
104104
rm ./actions-runner-linux-x64-$GITHUB_RUNNER_VERSION.tar.gz
105105

106+
# Pre-cache llvm-project in these images; this works with the premerge action
107+
# to speed up runs; cloning LLVM fresh takes >1min otherwise.
108+
#
109+
# A local experiment showed an explicit `git gc --aggressive` reduced this
110+
# layer's size by 20% (~800MB). Disable GC'ing afterward, so we don't waste time
111+
# trying to do that in CI.
112+
RUN \
113+
git clone https://github.com/llvm/llvm-project --tags && \
114+
cd llvm-project && \
115+
git gc --aggressive && \
116+
git config gc.auto 0

.github/workflows/premerge.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ concurrency:
2626
jobs:
2727
premerge-checks-linux:
2828
name: Linux Premerge Checks (Test Only - Please Ignore Results)
29+
defaults:
30+
run:
31+
# The premerge Linux docker instance keeps a pristine clone of LLVM in
32+
# /home/gha/llvm-project; that should be used as our main workdir.
33+
working-directory: /home/gha/llvm-project
2934
if: >-
3035
github.repository_owner == 'llvm' &&
3136
(github.event_name != 'pull_request' || github.event.action != 'closed')
@@ -34,7 +39,7 @@ jobs:
3439
- name: Checkout LLVM
3540
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3641
with:
37-
fetch-depth: 2
42+
path: /home/gha/llvm-project
3843
- name: Setup ccache
3944
uses: hendrikmuhs/ccache-action@a1209f81afb8c005c13b4296c32e363431bffea5 # v1.2.17
4045
with:

0 commit comments

Comments
 (0)