Ambiguify to the closest major version of LLVM #81
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-major-version: ["18"] | |
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-major-version }} | |
sudo apt install libpolly-17-dev libz-dev | |
- id: cache-llvm-src | |
name: Cache LLVM ${{ matrix.llvm-major-version }} source tree (Mac & Windows) | |
if: ${{ matrix.os != 'ubuntu-latest' }} | |
uses: actions/cache@v4 | |
with: | |
path: ./llvm-src | |
key: ${{ matrix.os }}-llvm-${{ matrix.llvm-major-version }}-src | |
- id: checkout-llvm | |
if: ${{ matrix.os != 'ubuntu-latest' }} && steps.cache-llvm-src.outputs.cache-hit != 'true' | |
name: Checkout LLVM ${{ matrix.llvm-major-version }} (Mac & Windows) | |
uses: actions/checkout@v4 | |
with: | |
repository: llvm/llvm-project | |
ref: release/${{ matrix.llvm-major-version }}.x | |
path: ./llvm-src | |
# Cached LLVM build files. | |
- id: cache-llvm-build | |
name: Cache LLVM ${{ matrix.llvm-major-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-major-version }}-build | |
- id: build-llvm | |
if: ${{ matrix.os != 'ubuntu-latest' }} && steps.cache-llvm-build.outputs.cache-hit != 'true' | |
name: Build LLVM ${{ matrix.llvm-major-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-major-version }} installation output (Mac & Windows) | |
if: ${{ matrix.os != 'ubuntu-latest' }} | |
uses: actions/cache@v4 | |
with: | |
path: ./llvm-install | |
key: ${{ matrix.os }}-llvm-${{ matrix.llvm-major-version }}-install | |
- id: install-llvm | |
name: Install LLVM ${{ matrix.llvm-major-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 |