Skip to content

x86-Ubuntu-llvm-from-sources #1390

x86-Ubuntu-llvm-from-sources

x86-Ubuntu-llvm-from-sources #1390

name: x86-Ubuntu-llvm-from-sources
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Download Ninja
run: |
git clone https://github.com/ninja-build/ninja.git
pushd ninja
./configure.py --bootstrap
popd
- name: Add Ninja to $PATH
run: |
echo "${GITHUB_WORKSPACE}/ninja" >> $GITHUB_PATH
- name: Clone llvm-project
run: |
git clone --depth 1 --single-branch --branch release/18.x https://github.com/llvm/llvm-project
- name: Make ld.gold the default linker
run: |
# This a quick and easy hack. Not something I would use on my
# production machine.
sudo rm /usr/bin/ld
sudo ln -s /usr/bin/x86_64-linux-gnu-ld.gold /usr/bin/ld
- name: Build LLVM & Clang
run: |
cd llvm-project
git checkout release/18.x
mkdir build && cd build
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DLLVM_OPTIMIZED_TABLEGEN=ON \
../llvm
ninja
- name: Install lit
run: |
sudo apt-get install python3-setuptools
sudo pip3 install lit
- name: Build HelloWorld
run: |
cd HelloWorld
mkdir build && cd build
# HelloWorld only supports CT_Clang_INSTALL_DIR
cmake -DCT_Clang_INSTALL_DIR="$GITHUB_WORKSPACE/llvm-project/build" ../
make -j2
- name: Build llvm-tutor + run tests
run: |
mkdir build && cd build
# Test with Clang_DIR
cmake -DClang_DIR="$GITHUB_WORKSPACE/llvm-project/build/lib/cmake/clang/" ../
make -j2
lit test/