Skip to content

Special-case LLVM installation on ubuntu #80

Special-case LLVM installation on ubuntu

Special-case LLVM installation on ubuntu #80

Workflow file for this run

# 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:
- name: Install LLVM (Ubuntu only).
if: ${{ matrix.os == 'ubuntu-latest' }}
# See: https://apt.llvm.org/
# Last line: https://gitlab.com/taricorp/llvm-sys.rs/-/issues/13
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${{ matrix.llvm-version }}
sudo apt install libpolly-17-dev libz-dev
- id: cache-llvm-src
name: Cache LLVM ${{ matrix.llvm-version }} source tree (Mac & Windows)
if: ${{ matrix.os != 'ubuntu-latest' }}
uses: actions/cache@v4
with:
path: ./llvm-src
key: ${{ matrix.os }}-llvm-${{ matrix.llvm-version }}-src
- id: checkout-llvm
if: ${{ matrix.os != 'ubuntu-latest' }} && steps.cache-llvm-src.outputs.cache-hit != 'true'
name: Checkout LLVM ${{ matrix.llvm-version }} (Mac & Windows)
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 (Mac & Windows)
if: ${{ matrix.os != 'ubuntu-latest' }}
uses: actions/cache@v4
with:
path: ./llvm-src/build
key: ${{ matrix.os }}-llvm-${{ matrix.llvm-version }}-build
- id: build-llvm
if: ${{ matrix.os != 'ubuntu-latest' }} && steps.cache-llvm-build.outputs.cache-hit != 'true'
name: Build LLVM ${{ matrix.llvm-version }} (Mac & Windows)
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 (Mac & Windows)
if: ${{ matrix.os != 'ubuntu-latest' }}
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 }} (Mac and Windows)
if: ${{ matrix.os != 'ubuntu-latest' }}
working-directory: ./llvm-src
run: |
cmake --build build --target install
- name: Get the LLVM version
run: llvm-config --version
- name: Checkout Wright source
uses: actions/checkout@v4
- name: Run cargo check
run: cargo check