Skip to content

Commit c62674b

Browse files
committed
chore(ci): build llvm on cache miss instead of website download
- Remove website download/publish steps for LLVM; cache misses now fetch sources and build locally before caching. - Simplifies CI by relying solely on GitHub Actions cache for LLVM artifacts and dropping the external website dependency. - Developers don't need help to update download binaries anymore. The local build became reasonable with the slim llvm build.
1 parent 07e3903 commit c62674b

File tree

1 file changed

+3
-93
lines changed

1 file changed

+3
-93
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -332,36 +332,6 @@ jobs:
332332
path: ${{ steps.rmatrix.outputs.llvm-path }}
333333
key: ${{ matrix.llvm-archive-basename }}
334334

335-
- name: Download LLVM Binaries
336-
id: llvm-download
337-
if: steps.llvm-cache.outputs.cache-hit != 'true'
338-
run: |
339-
set -x
340-
url=https://mrdocs.com/llvm+clang/${{ matrix.llvm-archive-filename }}
341-
http_status=$(curl -s -o /dev/null -w "%{http_code}" -I "$url")
342-
if [ "$http_status" -eq 200 ]; then
343-
found="true"
344-
echo "found=$found" >> $GITHUB_OUTPUT
345-
curl -L -o ${{ matrix.llvm-archive-filename }} "$url"
346-
install_prefix=${{ steps.rmatrix.outputs.llvm-path }}
347-
mkdir -p $install_prefix
348-
if [[ ${{ matrix.llvm-archive-extension }} == '7z' ]]; then
349-
7z x ${{ matrix.llvm-archive-filename }} -o$install_prefix
350-
else
351-
tar -xjf ${{ matrix.llvm-archive-filename }} -C $install_prefix
352-
fi
353-
if [[ $(ls -1 $install_prefix | wc -l) -eq 1 ]]; then
354-
single_dir=$(ls -1 $install_prefix)
355-
if [[ -d $install_prefix/$single_dir ]]; then
356-
mv $install_prefix/$single_dir/* $install_prefix/
357-
rmdir $install_prefix/$single_dir
358-
fi
359-
fi
360-
else
361-
found="false"
362-
echo "found=$found" >> $GITHUB_OUTPUT
363-
fi
364-
365335
# Installs libc++ separately, using the LLVM standalone runtimes build.
366336
# The libc++ built here will be built using the host compiler, so this is
367337
# limited by what libc++ at the current LLVM revision supports.
@@ -376,7 +346,7 @@ jobs:
376346
# Currently GCC fails linking it, and for MacOS there are compiler-rt
377347
# requirements not satisfied.
378348
- name: Fetch LLVM source archive
379-
if: steps.llvm-cache.outputs.cache-hit != 'true' && steps.llvm-download.outputs.found != 'true'
349+
if: steps.llvm-cache.outputs.cache-hit != 'true'
380350
run: |
381351
set -eux
382352
mkdir -p ../third-party
@@ -392,7 +362,7 @@ jobs:
392362
- name: Install libc++
393363
id: install_libcxx
394364
uses: alandefreitas/cpp-actions/[email protected]
395-
if: matrix.use-libcxx == 'true' && steps.llvm-cache.outputs.cache-hit != 'true' && steps.llvm-download.outputs.found != 'true'
365+
if: matrix.use-libcxx == 'true' && steps.llvm-cache.outputs.cache-hit != 'true'
396366
with:
397367
cmake-version: '>=3.26'
398368
source-dir: ../third-party/llvm-project/runtimes
@@ -426,7 +396,7 @@ jobs:
426396
- name: Install LLVM
427397
id: install_llvm
428398
uses: alandefreitas/cpp-actions/[email protected]
429-
if: steps.llvm-cache.outputs.cache-hit != 'true' && steps.llvm-download.outputs.found != 'true'
399+
if: steps.llvm-cache.outputs.cache-hit != 'true'
430400
with:
431401
cmake-version: '>=3.26'
432402
source-dir: ../third-party/llvm-project/llvm
@@ -1254,69 +1224,9 @@ jobs:
12541224
with:
12551225
apt-get: ${{ matrix.install }}
12561226

1257-
- name: Check website releases
1258-
id: website-releases
1259-
run: |
1260-
set -x
1261-
archive_url="https://mrdocs.com/llvm+clang/${{ matrix.llvm-archive-filename }}"
1262-
http_status=$(curl -s -o /dev/null -w "%{http_code}" -I "$archive_url")
1263-
if [ "$http_status" -eq 200 ]; then
1264-
exists="true"
1265-
else
1266-
exists="false"
1267-
fi
1268-
echo "exists=$exists" >> $GITHUB_OUTPUT
1269-
12701227
- name: LLVM Binaries
12711228
id: llvm-cache
1272-
if: steps.website-releases.outputs.exists != 'true'
12731229
uses: actions/cache@v4
12741230
with:
12751231
path: ${{ steps.rmatrix.outputs.llvm-path }}
12761232
key: ${{ matrix.llvm-archive-basename }}
1277-
1278-
- name: Compress LLVM
1279-
id: llvm-upload
1280-
if: steps.llvm-cache.outputs.cache-hit == 'true'
1281-
shell: bash
1282-
run: |
1283-
# LLVM is be installed with the default compiler
1284-
set -x
1285-
1286-
# Use 7z on windows
1287-
if [[ ${{ runner.os }} == 'Windows' ]]; then
1288-
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on "${{ matrix.llvm-archive-filename }}" "${{ steps.rmatrix.outputs.llvm-path }}"
1289-
else
1290-
tar -cjf "${{ matrix.llvm-archive-filename }}" -C "${{ steps.rmatrix.outputs.llvm-path }}/.." llvm
1291-
fi
1292-
1293-
- name: Website LLVM Releases
1294-
if: steps.llvm-cache.outputs.cache-hit == 'true' && github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/'))
1295-
run: |
1296-
set -x
1297-
1298-
# Ensure required commands exist
1299-
for cmd in ssh-keyscan ssh-agent ssh-add scp; do
1300-
if ! command -v $cmd >/dev/null; then
1301-
echo "$cmd not found"
1302-
exit 1
1303-
fi
1304-
done
1305-
1306-
# Add SSH key
1307-
mkdir -p ~/.ssh
1308-
ssh-keyscan dev-websites.cpp.al >> ~/.ssh/known_hosts
1309-
chmod 600 ~/.ssh/known_hosts
1310-
echo "${{ secrets.DEV_WEBSITES_SSH_KEY }}" > ~/.ssh/github_actions
1311-
chmod 600 ~/.ssh/github_actions
1312-
1313-
# Start ssh-agent and add the key
1314-
SSH_AUTH_SOCK="$RUNNER_TEMP/ssh_agent.sock"
1315-
export SSH_AUTH_SOCK
1316-
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
1317-
ssh-add ~/.ssh/github_actions
1318-
1319-
# Copy llvm archive: This step will copy the archive to www.mrdocs.com/llvm+clang
1320-
llvm_dir="/var/www/mrdox.com/llvm+clang"
1321-
chmod 755 ${{ matrix.llvm-archive-filename }}
1322-
scp -o StrictHostKeyChecking=no $(pwd)/${{ matrix.llvm-archive-filename }} [email protected]:$llvm_dir/

0 commit comments

Comments
 (0)