ci: share LLVM setup steps

This commit is contained in:
Jake Bailey
2026-09-04 14:43:37 -07:00
committed by Ron Evans
parent ae47aa4a55
commit e32508b706
2 changed files with 67 additions and 50 deletions
+64
View File
@@ -0,0 +1,64 @@
name: Set up LLVM
description: Restore or build LLVM with assertions enabled
inputs:
save-cache:
description: Save LLVM caches after a cache miss
required: false
default: "true"
runs:
using: composite
steps:
- name: Restore LLVM source cache
uses: actions/cache/restore@v5
id: cache-llvm-source
with:
key: llvm-source-22-linux-ubuntu-24.04-asserts-v1-${{ hashFiles('llvm-version.txt') }}
path: |
llvm-project/clang/lib/Headers
llvm-project/clang/include
llvm-project/compiler-rt
llvm-project/lld/include
llvm-project/llvm/include
- name: Download LLVM source
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
shell: bash
run: make llvm-source
- name: Save LLVM source cache
uses: actions/cache/save@v5
if: inputs.save-cache == 'true' && steps.cache-llvm-source.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-llvm-source.outputs.cache-primary-key }}
path: |
llvm-project/clang/lib/Headers
llvm-project/clang/include
llvm-project/compiler-rt
llvm-project/lld/include
llvm-project/llvm/include
- name: Restore LLVM build cache
uses: actions/cache/restore@v5
id: cache-llvm-build
with:
key: llvm-build-22-linux-ubuntu-24.04-asserts-v1-${{ hashFiles('llvm-version.txt') }}
path: llvm-build
- name: Install Ninja
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
shell: bash
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends ninja-build
- name: Build LLVM
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
shell: bash
run: |
rm -rf llvm-project
make llvm-source
make llvm-build ASSERT=1
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
- name: Save LLVM build cache
uses: actions/cache/save@v5
if: inputs.save-cache == 'true' && steps.cache-llvm-build.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-llvm-build.outputs.cache-primary-key }}
path: llvm-build
+3 -50
View File
@@ -220,7 +220,7 @@ jobs:
assert-test-linux:
# Run all tests that can run on Linux, with LLVM assertions enabled to catch
# potential bugs.
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
@@ -239,8 +239,7 @@ jobs:
qemu-system-arm \
qemu-system-riscv32 \
qemu-user \
simavr \
ninja-build
simavr
- name: Install Go
uses: actions/setup-go@v6
with:
@@ -264,53 +263,7 @@ jobs:
"https://github.com/espressif/qemu/releases/download/$release/$archive"
tar -xJf "$RUNNER_TEMP/$archive" -C "$RUNNER_TEMP"
echo "$RUNNER_TEMP/qemu/bin" >> "$GITHUB_PATH"
- name: Restore LLVM source cache
uses: actions/cache/restore@v5
id: cache-llvm-source
with:
key: llvm-source-22-linux-asserts-v1-${{ hashFiles('llvm-version.txt') }}
path: |
llvm-project/clang/lib/Headers
llvm-project/clang/include
llvm-project/compiler-rt
llvm-project/lld/include
llvm-project/llvm/include
- name: Download LLVM source
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
run: make llvm-source
- name: Save LLVM source cache
uses: actions/cache/save@v5
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-llvm-source.outputs.cache-primary-key }}
path: |
llvm-project/clang/lib/Headers
llvm-project/clang/include
llvm-project/compiler-rt
llvm-project/lld/include
llvm-project/llvm/include
- name: Restore LLVM build cache
uses: actions/cache/restore@v5
id: cache-llvm-build
with:
key: llvm-build-22-linux-asserts-v1-${{ hashFiles('llvm-version.txt') }}
path: llvm-build
- name: Build LLVM
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
run: |
# fetch LLVM source
rm -rf llvm-project
make llvm-source
# build!
make llvm-build ASSERT=1
# Remove unnecessary object files (to reduce cache size).
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
- name: Save LLVM build cache
uses: actions/cache/save@v5
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-llvm-build.outputs.cache-primary-key }}
path: llvm-build
- uses: ./.github/actions/setup-llvm
- name: Cache Binaryen
uses: actions/cache@v5
id: cache-binaryen