Build with different version #1192
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
name: Build with different version | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: "0 2 * * *" | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04] | |
version: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set Ubuntu codename (Bionic) | |
if: ${{ matrix.os == 'ubuntu-18.04'}} | |
run: echo "UBUNTU_CODENAME=bionic" >> $GITHUB_ENV | |
- name: Set Ubuntu codename (Focal) | |
if: ${{ matrix.os == 'ubuntu-20.04'}} | |
run: echo "UBUNTU_CODENAME=focal" >> $GITHUB_ENV | |
- name: Install Dependencies | |
run: | | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
if test ${{ matrix.version }} == 19; then | |
sudo apt-add-repository "deb http://apt.llvm.org/${{ env.UBUNTU_CODENAME }}/ llvm-toolchain-${{ env.UBUNTU_CODENAME }} main" | |
else | |
sudo apt-add-repository "deb http://apt.llvm.org/${{ env.UBUNTU_CODENAME }}/ llvm-toolchain-${{ env.UBUNTU_CODENAME }}-${{ matrix.version }} main" | |
fi | |
if test ${{ matrix.version }} -ge 14 -a ${{ env.UBUNTU_CODENAME }} == "bionic"; then | |
# Recent versions of llvm need a compiler with C++ 20 support. Bionic doesn't have this out of the box. | |
# It requires a more recent version of libstdc++ | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
fi | |
sudo apt-get update | |
sudo apt-get install -y clang-${{ matrix.version }} clangd-${{ matrix.version }} clang-tidy-${{ matrix.version }} clang-format-${{ matrix.version }} clang-tools-${{ matrix.version }} llvm-${{ matrix.version }}-dev lld-${{ matrix.version }} lldb-${{ matrix.version }} llvm-${{ matrix.version }}-tools libomp-${{ matrix.version }}-dev libc++-${{ matrix.version }}-dev libc++abi-${{ matrix.version }}-dev libclang-common-${{ matrix.version }}-dev libclang-${{ matrix.version }}-dev libclang-cpp${{ matrix.version }}-dev | |
if test ${{ matrix.version }} -gt 11; then | |
sudo apt-get install -y libunwind-${{ matrix.version }}-dev | |
fi | |
# C++ backend for mlir only appeared with LLVM 14 | |
if test ${{ matrix.version }} -gt 13; then | |
sudo apt-get install -y mlir-${{ matrix.version }}-tools libmlir-${{ matrix.version }}-dev | |
fi | |
# Exists only after LLVM 15 | |
if test ${{ matrix.version }} -gt 14; then | |
sudo apt-get install -y libpolly-${{ matrix.version }}-dev | |
fi | |
- name: Run the testsuite | |
shell: bash | |
run: | | |
# temporary workaround | |
# The path to analyze-cc needs to be set, it will be fixed in | |
# future upload of apt.llvm.org | |
export PATH=$PATH:/usr/share/clang/scan-build-py-${{ matrix.version }}/bin/:/usr/lib/llvm-${{ matrix.version }}/libexec | |
mkdir build && cd build | |
LIBUNWIND_ENABLED=ON | |
STATIC_LIBCXX_ENABLED=ON | |
if test ${{ matrix.version }} -lt 12; then | |
# Libunwind has been packaged only from 12 | |
LIBUNWIND_ENABLED=OFF | |
# libc++.a did not link libc++abi.a on old versions | |
STATIC_LIBCXX_ENABLED=OFF | |
fi | |
cmake -DLIT=/usr/lib/llvm-${{ matrix.version }}/build/utils/lit/lit.py \ | |
-DCLANG_BINARY=/usr/bin/clang-${{ matrix.version }} \ | |
-DCLANGXX_BINARY=/usr/bin/clang++-${{ matrix.version }} \ | |
-DCLANG_TIDY_BINARY=/usr/bin/clang-tidy-${{ matrix.version }} \ | |
-DCLANG_FORMAT_BINARY=/usr/bin/clang-format-${{ matrix.version }} \ | |
-DCLANG_FORMAT_DIFF_BINARY=/usr/bin/clang-format-diff-${{ matrix.version }} \ | |
-DCLANGD_BINARY=/usr/bin/clangd-${{ matrix.version }} \ | |
-DLLD_BINARY=/usr/bin/lld-${{ matrix.version }} \ | |
-DLLDB_BINARY=/usr/bin/lldb-${{ matrix.version }} \ | |
-DLLVMCONFIG_BINARY=/usr/bin/llvm-config-${{ matrix.version }} \ | |
-DLLVMOBJDUMP_BINARY=/usr/bin/llvm-objdump-${{ matrix.version }} \ | |
-DOPT_BINARY=/usr/bin/opt-${{ matrix.version }} \ | |
-DSCANBUILD=/usr/bin/scan-build-${{ matrix.version }} \ | |
-DSCANBUILDPY=/usr/bin/scan-build-py-${{ matrix.version }} \ | |
-DCLANG_TIDY_BINARY=/usr/bin/clang-tidy-${{ matrix.version }} \ | |
-DSCANVIEW=/usr/bin/scan-view-${{ matrix.version }} \ | |
-DLLVMNM=/usr/bin/llvm-nm-${{ matrix.version }} \ | |
-DLLC=/usr/bin/llc-${{ matrix.version }} \ | |
-DLLI=/usr/bin/lli-${{ matrix.version }} \ | |
-DOPT=/usr/bin/opt-${{ matrix.version }} \ | |
-DMLIRTRANSLATE=/usr/bin/mlir-translate-${{ matrix.version }} \ | |
-DLLVMPROFDATA=/usr/bin/llvm-profdata-${{ matrix.version }} \ | |
-DENABLE_COMPILER_RT=ON \ | |
-DENABLE_LIBCXX=ON \ | |
-DENABLE_STATIC_LIBCXX=$STATIC_LIBCXX_ENABLED \ | |
-DENABLE_LIBUNWIND=$LIBUNWIND_ENABLED \ | |
../ | |
# debug the output | |
cat tests/lit.site.cfg | |
make check |