Install LLVM #77
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Combined cargo check with LLVM installation for the three major platforms. | |
name: Cargo Check | |
on: ["push", "pull_request"] | |
# Cancel in-progress runs for previous commits if there are any that haven't completed yet. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
llvm-version: ["18.1.1"] | |
runs-on: ${{ matrix.os }} | |
# Cached checkout of the LLVM source code, excluding CLANG and any other tools we don't need. | |
steps: | |
- id: cache-llvm-src | |
name: Cache LLVM ${{ matrix.llvm-version }} source tree | |
uses: actions/cache@v4 | |
with: | |
path: ./llvm-src | |
key: ${{ matrix.os }}-llvm-${{ matrix.llvm-version }}-src | |
- id: checkout-llvm | |
if: steps.cache-llvm-src.outputs.cache-hit != 'true' | |
name: Checkout LLVM ${{ matrix.llvm-version }} | |
uses: actions/checkout@v4 | |
with: | |
repository: llvm/llvm-project | |
ref: llvmorg-${{ matrix.llvm-version }} | |
path: ./llvm-src | |
# Cached LLVM build files. | |
- id: cache-llvm-build | |
name: Cache LLVM ${{ matrix.llvm-version }} build output | |
uses: actions/cache@v4 | |
with: | |
path: ./llvm-src/build | |
key: ${{ matrix.os }}-llvm-${{ matrix.llvm-version }}-build | |
- id: build-llvm | |
if: steps.cache-llvm-build.outputs.cache-hit != 'true' | |
name: Build LLVM ${{ matrix.llvm-version }} | |
working-directory: ./llvm-src | |
# Use lld if on windows. It's not available otherwise it seems. | |
run: | | |
cmake -S llvm -B build -DCMAKE_INSTALL_PREFIX=../llvm-install -DCMAKE_BUILD_TYPE=Release ${{ matrix.os == 'windows-latest' && '-DLLVM_USE_LINKER=lld' }} | |
# Cached LLVM installation. | |
- id: cache-llvm-install | |
name: Cache LLVM ${{ matrix.llvm-version }} installation output | |
uses: actions/cache@v4 | |
with: | |
path: ./llvm-install | |
key: ${{ matrix.os }}-llvm-${{ matrix.llvm-version }}-install | |
- id: install-llvm | |
name: Install LLVM ${{ matrix.llvm-version }} | |
working-directory: ./llvm-src | |
run: | | |
cmake --build build --target llvm |